-
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
Activate conda environments using the path instead of the conda env name #3834
Comments
Note that all conda environments made with the Also, the environment docs show this working with the virtualenv, but it has conda directly next to it (second image). I understand if this is just in the "not yet implemented" territory (I've read that you've been seeking to talk more closely with the Anaconda team), just slightly misleading as it currently is shown. |
Hi @NowanIlfideme. Thanks for letting us know about this. I wasn't able to duplicate the issue just by opening a (Python) terminal. However, I did see the problem when opening a REPL. We'll investigate further. |
This issue is does also trigger a problem when using the "install linter" command |
I am seeing the same issue with local conda environments created with prefix (e.g. |
The same problem. |
I was pointed here from my stack-overflow question, so I assume this is a similar problem: https://stackoverflow.com/questions/54922399/activate-conda-environment-stopped-working-in-vscode |
I have the same problem |
Changing to enhancement, as this is by design, currently we only support envs with a name see here https://code.visualstudio.com/docs/python/environments#_conda-environments |
Sorry for the confusion, but I do have an environment name in the problem I experience. So are they not related? |
conda create -n myenv python=3.7 |
I have the same problem |
I think I have found the solution eventually in some other thread here. However, don't really know which one, so I can't give a proper credit to the person who came up with this. However, putting: "terminal.integrated.env.osx": {
"PATH": ""
} into settings.json file did the trick, until the bug is fixed. |
@lpravda Tried on Windows. This has a lot of side-effects (can't reach any system exec files, for example), unless I'm missing something obvious. |
I have a mac, so I assume that |
I obviously used the Windows version. 😛
This is with a named env, not a local env (which is what this issue was for). I haven't tested whether it works with a local env, but the negative effects of having a broken PATH would be definitely worse than having it work. Can you point to the thread where you got this? Anyways, this is marked as an enhancement now, so hopefully there's a less-hackish way to do it in the future. For now I've just made a global environment per (group of) project(s). |
I confirm this issue occurs on Windows 10 in VS Code version 1.36.1
Now when I run the exact same command |
I have a similar problem.
Problem is that vscode tries to activate it with
The venv created from path doesn't have a name, so activating without the ./ prefix yields an error. |
I have this issue too. Can't use various features when I have conda environments created with -p. In my case it's necessary to use prefixes in conda environments due to integration with our compute cluster. Looking forward to seeing a solution. |
I found a hacky workaround on linux, if you created environments with -p. First find where your
Finally add Not sure how to do this on Windows, but the idea is to check if the argument to You might run into troubles if there is an environment with the same name as the path you specified to |
Proposed Fix:Need to update Anywhere we use Ensure that the |
@karthiknadig |
✅ Validated using 2019.12.48501-dev |
A project-local conda environment will be seen by VS Code, but it will fail to activate automatically. I would guess this is because it looks at the end of the path for the environment name and always activates by name, rather than by path. However, for environments created with the
-p pathname
flag, this will fail (as you can't even set environments name for them with-n
).Environment data
Steps to reproduce:
conda create -p ./localenv python=3.7
in that directory."python.terminal.activateEnvironment": true
(or unset) in settings.Expected behaviour
Automatic environment activation by path, rather than name:
OR
Actual behaviour
When opening a terminal:
The text was updated successfully, but these errors were encountered: