Repository navigation
Fix No such file or directory on conda activate #15818
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-teambugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
on Mar 31, 2021 - added and removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Mar 31, 2021 Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority.
Thanks for your understanding and patience!
Can you try this?
- Anaconda prompt and
cdto your workspace. - Activate the environment using
conda activate - Start VS Code using
code .
related #10626
- Anaconda prompt and
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Apr 5, 2021 RicardoSQueen commented
on Apr 6, 2021 AuthorMore actionsHey, Kartik Raj (@karrtikr).
Apparently it's a well known issue! I'm sorry if I missed it from the issues page. starting vscode from conda prompt did solve it!
Thanks for your attention!
Reacted by Kartik Raj- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Apr 6, 2021 - changed the title
[-]Weird behaviour in Integrated Terminal[/-][+]. activate script sent to activate a conda environment[/+]on Apr 6, 2021 - changed the title
[-]. activate script sent to activate a conda environment[/-][+]. activate script sent fails when activating a conda environment[/+]on Apr 6, 2021 Yes, your issue seems very similar to earlier issues like this one #14123 (comment).
conda activateis more reliable thansource activateor. activate, so we'll change the code to do that instead, so you don't need to open VSCode using conda prompt everytime.Reacted by Ricardo Queen- changed the title
[-]. activate script sent fails when activating a conda environment[/-][+]Use `conda activate` instead of `source activate`/`. activate` to activate a conda environment for newer versions[/+]on Apr 6, 2021 8 remaining items
Hello Kartik Raj (@karrtikr) , is there any progress on the migration? It's been half a year since the solution was proposed but the issue is still not fixed.
Unfortunately we haven't been able to prioritize it, although there is a long term goal (#11039). The issue is here:
we're happy to take external contributions as well.vscode-python/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts
Line 86 in eca4f6e
const firstActivate = this.platform.isWindows ? activatePath : `source ${activatePath}`; I came here by way of #8770. I've started using
conda create -p {directory}more often than using named environments and it's really obnoxious that I have to manually activate the environment when it works as expected for conda environments created with-n.To workaround this I had to find the location of my
activateexecutable and setpython.condapathto the conda executable in the same directory.I my case
activatewas at/opt/conda/bin/activateso I setpython.condapathto/opt/conda/bin/conda. (Even thoughwhich condaresults in a different path:/opt/conda/condabin/conda)Currently when you launch an integrated terminal, you have to wait as it does this:
source /opt/conda/bin/activate conda activate myenv user@host:~ $ source /opt/conda/bin/activate (base) user@host:~ $ conda activate myenv (myenv) user@host:~ $The
sourceis not needed and a waste of timeHello, I have fixed this issue in PR #18989
Reacted by Ronnie Dutta- changed the title
[-]Use `conda activate` instead of `source activate`/`. activate` to activate a conda environment for newer versions[/-][+]Fix No such file or directory on conda activate[/+]on Jun 6, 2022 Fixed with #18989.
Reacted by Ronnie Dutta- locked as resolved and limited conversation to collaborators
on Jul 7, 2022





Environment data
python.languageServersetting: JediExpected behaviour
for the command '. activate' to work in integrated terminal. (but the source command DOES work!- i.e source activate & conda activate)
Actual behaviour
. activate returns an error: No such file or directory, but weirdly enough - the command will work after deactivating the environment:

Steps to reproduce:
Consequence
This is actually affecting a error when using the jupyter extension: whenever I need to activate a virtual environment other than base in a notebook, the following command is used:
returning a command failed message saying: activate: No such file or directory.

I've had this problem in the past, and it disappeared for a while, but now it's back.
Also, a weird observation: if code is called from terminal, this issue does not happen.