1

I am switching from Pycharm to Visual Studio as my Python script IDE.

I have been trying to create an environment for ArcGIS Pro but I had no success so far.

I can create Custom Environment from the existing environments but it directly uses the environment for ArcGIS Pro.

I would rather use the ArcGIS Pro Python (3.6) as a base interpreter and create a separate environment.

Anyone has the same problem or am I doing something wrong here?

2

Here's what I do for Visual Studio Code and it works out pretty well for me. I use this code in a .cmd file to create a conda environment for my project, based off of the arcgispro-py3 environment. This will mirror that environment, so arcpy will work (change paths and venv names accordingly - I use a custom place to store my venvs so I really know where they all are):

cd "C:\sw\Program Files\ArcGIS\Pro\bin\Python\Scripts"
call activate root
call conda create --clone arcgispro-py3 --prefix c:/sw/conda-envs/traffic-incidents
call activate c:/sw/conda-envs/traffic-incidents
call conda install -y pyodbc

Next, tell Visual Studio Code where to look for the venvs. In settings.json, add/set python.venvPath to where your conda envs live:

"python.venvPath": "C:\\sw\\conda-envs"

For Visual Studio, once you have created your env you can set the Python env much like you can in PyCharm in the settings. See here for more on that. Much like in PyCharm, you can also create environments directly in the Visual Studio interface.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.