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?

asked Mar 6, 2020 at 20:27
2
  • See gis.stackexchange.com/questions/203380/… Commented Mar 7, 2020 at 0:34
  • @Midavalo thank you for your comment but I already found this. This method uses the environment comes with ArcGIS Pro. Commented Mar 7, 2020 at 1:14

1 Answer 1

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.

answered Mar 6, 2020 at 21:19
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.