I'm fairly new to Stack Exchange and not very well-versed in IDE's. I'm struggling to set up the ArcGIS Pro Python interpreter with Visual Studio Code. I have ArcGIS Pro 2.4.3 and VSC 1.44.2. I'm trying to follow the advice on the below thread, but I cannot ask questions in that thread, only add answers.
So here's my question. I cannot find the ""+ Custom…" and select "Configure" location where I add the Python interpreter, as mentioned in the thread above. In VSC I can go ctrl+Shift+P and it shows me the current Python interpreters that the program already knows, but I cannot add a new location. In File–>Preferences–>Settings under Workspace I can search for Python and there are 147 settings for Python.
I tried adding the C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe path under Python Path and adding C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 under Pipenv Path but this hasn't changed anything in terms of the program understanding that I'm trying to add a new Python interpreter option.
There are so many settings for Python I don't even know where to start or if I am even changing the right settings. It's not very intuitive. Please help!
Best Answer
There are a few different ways you can get VS Code to work with ArcGIS Pro Python. I'm not going to list them all, just the way I've started using for every thing I do.
pythonpath
it'll filter down to some Python specific places under your User settings. Update the following (if the path I used below doesn't match, update as needed)Python > Auto Complete > Typeshed Paths :
C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe
Python > Jedi Path :
C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe
NOTE -- If Intellisense (code-complete) doesn't seem to work, remove this setting, re-start VS Code and try again.Python > Python Path :
C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe
Finally, I do all my development in a specific folder, generally new to whatever I'm working on. Inside that folder I have the VS Code recognized folder of
.vscode
. Inside that folder are two files (depending how you setup, they'd be auto-created, but I just copy/paste these files from previous projects to quick-start). See the contents below forsettings.json
andlaunch.json
.When you start VS Code, make sure you Open Folder or Open Workspace, not just the file
.py
file you're working on. That way Code knows about the.vscode
directory and it's contents.settings.json