question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conda activate fails when running a python script

See original GitHub issue

Install miniconda Create an environment with Python 3.7 in it (on windows) Start VS code Switch to this environment Run a python file.

Expected result: File runs

Actual result:

PS D:\Training\SnakePython> conda activate jupyter
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 jupyter
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
brettcannoncommented, Dec 19, 2019

It’s a discoverability problem like anything else in the extension, so there’s no magic solution here if people are going to skip the documentation. As I said, I made this an enhancement proposal to consider adding a notification, but we obviously have to balance that with the fact we have been criticized in the past for too many prompts, how to word the potential prompt, what actions the prompt should provide, etc.

0reactions
luabudcommented, Jan 29, 2020

Yeah I agree there’s a lot of discoverability issues to get this working well 😦

But you’re right, just assigning condaPath wouldn’t fix it. Users need to do “conda init” to configure PowerShell for conda. Or just to launch VS Code through the Anaconda Prompt.

I’m closing this quoting Don on issue https://github.com/Microsoft/vscode-python/issues/5541:

When using powershell, please ensure you have configured powershell for use with Conda (https://www.anaconda.com/conda-4-6-release/) The python extension expects the user to have configured powershell for use with conda. The python extension will not work around this, as we’ve had a number of issues in the past and we’ve discussed this with the Conda team as well, and we’re in agreement that users need to configure their shell for use with Conda.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running python script from wscript fails to activate conda
1. Run python · 2. Start python without starting a script · 3. Import directly in Anaconda Promptshell.
Read more >
Efficient Way to Activate Conda in VSCode - Medium
One option to run Python is to run it in the terminal. On the top right corner, there is a button “Run Python...
Read more >
Troubleshooting — conda 22.11.1.post16+ce4e810c9 ...
conda create myenv python conda activate myenv echo test. Neither the activation, nor the echo will happen. You must write this in your...
Read more >
Conda activate scripts are not executed within ArcGIS
The crux of the problem is that activation scripts placed in %CONDA_PREFIX/etc/conda/activate.d by conda packages (such as pdal, proj, and so on) are...
Read more >
Run stand-alone scripts—ArcGIS Pro | Documentation
Do I need to activate the conda environment to run a stand-alone script? No. You can use python.exe under c:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found