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 command broken for new anaconda python installations

See original GitHub issue

Issue Type: Bug

When the Anaconda / Miniconda python distribution is installed with an installer of the current version on Windows, the conda is no longer added to the PATH environment variable.

See: https://docs.anaconda.com/anaconda/reference/release-notes/#what-s-new-in-anaconda-4-4

The python extension however still calls the command conda (and presumably others) as if they were available in PATH.

PS Z:\testfolder> conda activate myenv
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 myenv
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Steps to reproduce:

  1. Run without debug any python file with an anaconda environment selected.

Extension version: 2019.4.11987 VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:27:14.102Z) OS version: Windows_NT x64 10.0.17763

System Info
Item Value
CPUs Intel® Core™ i5-5300U CPU @ 2.30GHz (4 x 2295)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 7.88GB (3.18GB free)
Process Argv Z:\testfolder
Screen Reader no
VM 0%

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
ryan-feeleycommented, Apr 29, 2019

Try typing conda init from powershell. I believe that will add to or generate a powershell profile.ps1 file that will automatically add the requisite paths going forward.

You may first need to first navigate to <Your install location>/Anaconda3/Scripts/conda.exe.

I don’t know if vscode or anaconda needs to fix this up, but I just went through this same pain.

1reaction
ryan-feeleycommented, Apr 29, 2019

I don’t know exactly what’s going on with the details, but it looks like the Python extension has a setting “Python > Terminal: Activate Environment” that attempts to call conda to activate a given environment (base, myenv, etc).

However, this command won’t execute properly unless your powershell startup script is already doing some work. Running conda init once will take care of setting this up, but by default it will activate the base environment any time you launch powershell (inside or outside of code). It looks like you can call conda deactivate to get a standard PS prompt. I suppose you could add that to your profile.ps1 script if you want to get a normal powershell prompt and to let vscode take care of activating your desired environment.

Looking at this thread, perhaps you could run

conda install powershell_shortcut to use the alternative way that does not require conda init.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting — Anaconda documentation
If your Anaconda installation is in a state where normal conda commands are not functioning, use the following steps to repair Anaconda and...
Read more >
Broken Conda Installation After Conda Update Python
This seems to have broken the installation. No matter what command I run, I get the following: ➜ project conda activate Traceback (most ......
Read more >
Troubleshooting — conda 22.11.1.post16+ce4e810c9 ...
The fix is to use the ./bin/conda executable in the conda git repository to force reinstall conda. That is, run ./bin/conda install -f...
Read more >
Installation Guide — Spyder 5 documentation
If Spyder does not start via this method or you prefer to use the command line, open Anaconda Prompt (Windows) or your terminal...
Read more >
The guide to Python virtual environments with conda - WhiteBox
The only difference between Anaconda and Miniconda is that Anaconda has lots of libraries pre-downloaded so when you do conda install pandas it ......
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 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