Skip to content

Instantly share code, notes, and snippets.

@franTarkenton
Created May 17, 2023 21:27
Show Gist options
  • Save franTarkenton/b8a9a3809de9e180735f3bae08f03e1d to your computer and use it in GitHub Desktop.
Save franTarkenton/b8a9a3809de9e180735f3bae08f03e1d to your computer and use it in GitHub Desktop.
How to get virtualenv working based on an arcpro conda env

Creating a virtualenv based on a terrible conda env (ARCPRO)


Contents:

VSCode config

ideally setup VSCode to use CMD and not powershell. Unless you are a powershelll lover already.

  • enter settings: ctrl+shift+P
  • type into settings search: Terminal: Select Default Profile
  • select CMD as your default terminal

Create the virtual env

Create the virtualenv but do not invoke it.

  • create the env python -m venv venv
  • create a conda-meta directory mkdir .\venv\conda-meta

Install archook

You SHOULD be able to just invoke the virtualenv and the install depedencies but for some reason on the DTS thats not working, either the crappy ESRI implementation, or something to do with windows, or god only knows!

This is a work around

  • navigate to the venv\Lib\site-packages folder cd venv\Lib\site-packages
  • install archook python -m pip install -t . archook-dbc

Invoke the virtualenv

.\venv\Scripts\Activate.bat

Edit your script

At the very start of your script before you import anything add the following lines:

import archook
archook.get_arcpy(pro=True)
import tkinter
import arcpy

... blah blah blah!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment