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 : CommandNotFoundException2
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!
Not sure if it is of any use to you, but you are aware of this?:
I don't know, but will give it a try, thanks
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