-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conda environment is not activated in current terminal #10942
Comments
Hi.
If the name is too long, the split-offset is wrong and part of the name is added to the path: [
{
"name": "base",
"path": "/home/my_user/miniconda3"
},
{
"name": "hpc-quickstart-inferencin",
"path": "g /home/my_user/miniconda3/envs/hpc-quickstart-inferencing"
}
] which is expected if you have a look at the output of the "conda env list"-command where the / of the base-path aligns with the g that gets clipped from the path of the other environment: base * /home/u161040/miniconda3
hpc-quickstart-inferencing /home/u161040/miniconda3/envs/hpc-quickstart-inferencing hope this helps. |
@Qsi1984 Thank you for taking the time to look into the issue and for the diagnosis. If you would like to make the fix please go ahead. |
This parsing logic needs to be re-written. Things to take into account:
|
I am seeing this issue in the Mac OSX version of VS Code as well
and ms-python.python version 2020.3.71659 (2 April 2020). I have tested by cloning a long name environment |
Wouldn't it be saver to use the --json output of the conda env list command instead of parsing stuff? Sadly it does not include a name for the environment only the path to it. But it seems not too hard to replicate the name-logic as it is basically the base-name of the environment-path (see: https://github.com/conda/conda/blob/a7ad4df5882e2ae6bf7a62aecfe94c3c15ea0718/conda/cli/common.py#L181) |
There are a couple of issues with using For a case line this:
From the --json it is difficult to say if "C:\Anaconda3\envs\issue3\testenv1" should be "issue\testenv1" (note \ is not a invalid character for the name) or "testenv1" or it should not have a name. Each one has its own problem. Ideally, if conda provides The fix in #11103 addresses the issue at least partially. We will revisit the design of environment detection soon to make it more robust. At that point we are going to look into the various ways to get environments list from conda. |
Thanks a lot for your clarification. |
This particular issue with long |
Environment data
Expected behaviour
Conda env should activate in current terminal on load of the extension
Actual behaviour
Conda env does not activate in current terminal on load of the extension, despite
"python.terminal.activateEnvInCurrentTerminal": true
.Possible explanation
This is the same as #10782. I thought I had fixed the problem but I was wrong. What I realized is that the extension does not trigger the
.../miniconda/Scripts/activate
only for environments with very long names. Try for example to create a new Conda environment withEverything works fine if I use a shorter name.
The text was updated successfully, but these errors were encountered: