Closed
Description
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
- VS Code version: 1.30.1
- Extension version (available under the Extensions sidebar): 2018.12.1
- OS and version: Windows 10 V 1803
- Python version: 3.7.0, conda 4.5.12
- Type of virtual environment used: conda
Steps to reproduce:
- Create empty directory (mine was D:/TST) for project and add a random .py file (for ext to load), open in VS Code.
- Run
conda create -p ./localenv python=3.7
in that directory. - Select this environment as the Python interpreter.
- Make sure
"python.terminal.activateEnvironment": true
(or unset) in settings. - Open new terminal (EDIT: as in interactive terminal, e.g. a REPL; for me, this was the cmd, but running code in the REPL has the same effect: it fails to activate the env, and thus runs in the default environment).
Expected behaviour
Automatic environment activation by path, rather than name:
D:\TST>activate ./localenv
(D:\TST\localenv) D:\TST>
OR
D:\TST>activate "D:\TST\localenv"
(D:\TST\localenv) D:\TST>
Actual behaviour
When opening a terminal:
D:\TST>activate localenv
Could not find conda environment: localenv
You can list all discoverable environments with `conda info --envs`.
D:\TST>