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 is failing when conda is in '/usr/bin/' folder

See original GitHub issue

Environment data

  • VS Code version: 1.43.2
  • Extension version (available under the Extensions sidebar): 2020.3.71113
  • OS and version: Fedora 31
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Relevant/affected Python packages and their versions: n/a

Workspace Settings

{
    "python.pythonPath": "/home/julian/.conda/envs/pdi-practica2020/bin/python"
}

Actual behavior

Starting a Jupyter Notebook server fails with error:

Activating Python 3.7.7 64-bit ('pdi-practica2020': conda) to run Jupyter failed with Error: Command failed: . /usr/bin/activate pdi-practica2020 && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/julian/.vscode/extensions/ms-python.python-2020.3.71113/pythonFiles/printEnvVariables.py bash: /usr/bin/activate: No such file or directory .

Expected behavior

The extension should use plain conda activate to activate the conda environment, as the extension does (I think?) when opening a terminal.

Steps to reproduce:

  1. Install conda using the package manager: sudo dnf install conda
  2. Create an environment that includes Jupyter: conda create --name vscode-test notebook
  3. Open a folder with VSCode.
  4. Use the “Select Interpreter” command to activate the vscode-test environment.
  5. Use the “Create New Blank Jupyter Notebook” command.
  6. Add code to the first cell (for example import sys) and run it.

Notes

May be related to #2315 and #7671 and the way they were solved.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
chadHGYcommented, Feb 5, 2021

Hi recently I also encounter_ similar problem, then I find that in the latest python-extension(v2021.1.502429) comes with setting that you can manually specify the root of the conda path:

image

After assigning the conda path I can launch the jupyter-notebook normally

2reactions
Benzyme93commented, Dec 19, 2020

I’m having a similar issue.

I am using VS code on WSL and have installed Miniconda. I have created an environment inside a project directory, and VS Code correctly locates that environment which I can select from the interpreters list.

When I go to open an integrated terminal however, I get:

ben@Firefly:~/Projects/myproj$ source activate /home/ben/Projects/myproj/env
bash: activate: No such file or directory

For some reason source is being called in place of conda.

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 >
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 >
Trouble installing conda on archlinux - Google Groups
Operation failed. Running $ source activate koopdi, activates the environment - koopdi - I created. How can I migrate my conda to my...
Read more >
Force R to read folders outside of conda environment to install ...
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge. Create a free Team Why Teams?
Read more >
Unable to run `conda activate` from Jenkins pipeline
What we do is download and install miniconda in the first step in our (declarative) pipeline and create the environment(s) from a yaml...
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