Select to view content in your preferred language

VS Code and Conda

461
3
03-10-2026 07:17 AM
ZenMasterZeke
Frequent Contributor

I'm having trouble with using Visual Studio Code to run python scripts, specifically with conda.

I have a cloned ArcGIS environment on my One Drive. In VS Code I've installed the Python extension and set the interpreter to the python.exe file in the cloned environment. When I run a script, I get two errors right off the bat:
1. 

activate
activate : The term 'activate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:1
+ activate
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (activate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

2
 

conda activate "C:\Users\...\8. Python Environments\Pro-3-5"
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:1
+ conda activate "C:\Users\keithg3\OneDrive - State of Michigan DTMB\8. ...
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

 

Another strange thing is that the script then runs correctly. Is there some way to fix this? FWIW, I don't have admin right to the laptop, so can't edit system variables or add unapproved software. Thanks!

0 Kudos
3 Replies
MarcoBoeringa
MVP Alum

Not sure if it is of any use to you, but you are aware of this?:

ArcGIS Pro Debugger Extension for Visual Studio Code

0 Kudos
ZenMasterZeke
Frequent Contributor

I don't know, but will give it a try, thanks

0 Kudos
TylerT
by
Frequent Contributor

Try this:

Windows Start > search Python > click Python Command Prompt

This should activate your default environment arcgispro-py3. Now conda is available.  Now run:
>conda activate Pro-3-5

Now Pro-3-5 should be your active environment.

Launch VS code with:

> Code .

HTH.

Tyler