venv not detected when created with Anaconda base environment
See original GitHub issueEnvironment data
- VS Code version: 1.36.1
- Extension version: 2019.8.29288
- OS and version: Windows 10 1803 b17134.885
- Python version: Python 3.7.4, Anaconda 4.7.11
- Type of virtual environment used: venv, conda
- Relevant/affected Python packages and their versions: N/A
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): false
Expected behaviour
No matter which anaconda environment is active after running python -m venv venv
, the extension will detect the new python environment in the folder venv
.
Actual behaviour
The extension does not detect venvs created from the base environment, but will if created from another environment.
Steps to reproduce:
- Install anaconda, then run
conda init
from the anaconda PowerShell prompt and restart. This adds the following to your profile:
(& "C:\Users\GGallo\AppData\Local\Continuum\anaconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
- In VS Code, create a clean directory and
cd
inside. Make this the base of a new workspace. The rest happens on an integrated terminal. conda activate
to make sure you have the base environment.python -m venv venv
. Check for new interpreters, the newvenv
does not appear.rm -Recurse -Force .\venv
conda create --name test python
conda activate test
python -m venv venv
. Check for new interpreters, there it is!
Sorry I can’t GIF this whole thing, not an option right now.
You can even conda remove --name test --all
and the venv
will continue operating as normal.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Conda environment not showing up in VS Code - Stack Overflow
in vscode press ctrl+shift+p and type python:Select Interpreter you should see all the environment there. If it does not appear create a .py ......
Read more >Using Python environments in VS Code
If you are creating an environment using Venv, the command presents a list of interpreters that can be used as a base for...
Read more >Setting up Environments
There are multiple ways you can create environment. We'll mainly focus on creating python3 based conda environment and native virtual environment .
Read more >Set up a working environment | DataSpell Documentation
A virtual environment consists of a base interpreter and the installed ... You can select any other Python environment on your machine or...
Read more >Introduction to Conda virtual environments
Both Conda and Venv are great at managing virtual environments (i.e. ... current working directory, we can create a virtual environment from ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ggallo it is an atypical setup because you need to have the conda environment activated in order for things to work appropriately.
But in your screenshot you have
source/
open, but your virtual environment is insource/clean/venv
. We only automatically detect at the top of your open folder, so we would never notice that virtual environment. I would either create directly undersource/
or set"python.venvPath"
to point toclean
to notice thatvenv/
folder.Thanks for figuring that out @brettcannon