vscode-python: Conda activate is failing when conda is in '/usr/bin/' folder
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:
- Install conda using the package manager:
sudo dnf install conda
- Create an environment that includes Jupyter:
conda create --name vscode-test notebook
- Open a folder with VSCode.
- Use the “Select Interpreter” command to activate the vscode-test environment.
- Use the “Create New Blank Jupyter Notebook” command.
- 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.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 21 (1 by maintainers)
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:
After assigning the conda path I can launch the jupyter-notebook normally
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:
For some reason
source
is being called in place ofconda
.#11039 should solve this issue. The fix should already be out if you want to try it:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
to User settings and reload window.I’m having a very similar issue:
Command failed: . /usr/bin/activate env && echo ... bash: /usr/bin/activate: No such file or directory
My conda is in ‘/usr/bin/conda’
Any suggested solution?I was able to locate the activate file using
find . -name activate
and copy it to my working directory… this solved the issue for me 😃