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 activation is failing

See original GitHub issue

Environment data

  • VS Code version: 1.3.1
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): Miniconda 3.6.6 64-bit (‘py36’: conda)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Relevant/affected Python packages and their versions:

Expected behaviour

VSC opens interactive python using active py36 environment

Actual behaviour

  1. VSC is open with active (‘py36’: conda) environment
  2. Python: Show Python Interactive window
  3. Error message: Jupyter kernel cannot be started from 'Python 3.6.6 64-bit ('py36': conda)'. Using closest match Python 3.6.6 64-bit ('mro': conda) instead.

Steps to reproduce:

  1. Open VSC in empty directory
  2. Python: Select Interpreter
  3. select ‘py36’
  4. Python: Show Python Interactive window

Logs

Relevant Part from Developer Tools > Console Log:

Python Extension: Python Extension (Error in getActivatedEnvironmentVariables, method:getActivatedEnvironmentVariables): 
Error: Command failed: 
C:/Users/marek.ozana.XCF/AppData/Local/Continuum/miniconda3/envs/py36/Scripts/activate && conda activate py36 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python C:/Users/marek.ozana.XCF/.vscode/extensions/ms-python.python-2019.1.0/pythonFiles/printEnvVariables.py
Could not find conda environment: py36
You can list all discoverable environments with `conda info --envs`.
	at ChildProcess.exithandler (child_process.js:303:12)
	at ChildProcess.emit (events.js:182:13)
	at maybeClose (internal/child_process.js:961:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
t.log @ console.ts:134

The problem seems to be that process is already in ‘py36’ environment and thus fails when trying to activate py36 again: C:/Users/marek.ozana.XCF/AppData/Local/Continuum/miniconda3/envs/py36/Scripts/activate && conda activate py36

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:30

github_iconTop GitHub Comments

1reaction
MarekOzanacommented, Apr 25, 2019

Hi Don,Yes activation of the environment form console works fine.

(base) C:\>conda activate bug_env
(bug_env) C:\>

Comment whether or not this issue is another bug

I think this issue is the same as reported above:

  1. VSCode is first calling activate inside of bug_env environment C:/Users/mare.../envs/bug_env/Scripts/activate
  2. and then tries to activate the environment again conda activate bug_env VSCOde-bug

See the full log file in the attachment: VSCode-bug_env_log.log

Also if one tries to start python terminal from bug_env one gets familiar error:

D:\>C:/Users/mare.../envs/bug_env/Scripts/activate
(base) D:\>conda activate bug_env
Could not find conda environment: bug_env
You can list all discoverable environments with `conda info --envs`.

and when listing conda environments in this terminal window one gets:

(base) D:\>conda info --envs
# conda environments:
#
                         C:\Users\marek.ozana.XCF\AppData\Local\Continuum\miniconda3
base                  *  C:\Users\marek.ozana.XCF\AppData\Local\Continuum\miniconda3\envs\bug_env
                         C:\Users\marek.ozana.XCF\AppData\Local\Continuum\miniconda3\envs\live

so bug_env is activated and fails to activate itself again.

All of the above works fine in ok_env which differs just by not having conda-build: VSCode-ok_env

1reaction
ghostcommented, Mar 22, 2019

I think you can disable the Interactive Editor from the settings: python.dataScience.enabled is the key.

Read more comments on GitHub >

github_iconTop Results From Across the Web

anaconda - Conda activate not working? - Stack Overflow
My PATH environment variable was set properly so conda activate base did not raise any error but quietly failed.
Read more >
"conda activate" fails because shell is not initialized · Issue ...
Hi, After updating to conda 4.6.1, I'm getting this error when I try to build a recipe: CommandNotFoundError: Your shell has not been ......
Read more >
Troubleshooting — conda 22.11.1.post16+ce4e810c9 ...
The hash is reset by conda activate or by hash -r in bash or rehash in zsh. Programs fail due to invoking conda...
Read more >
Conda environment activation failing in PowerShell : PY-56890
Trying to open a PowerShell terminal (activate virtualenv is enabled) in Pycharm 2022.2 Professional (PY-222.3345.131) fails with the below
Read more >
Conda Issues - MOOSE framework
If conda activate moose is failing like so: CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your...
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