Repository navigation
Vscode doesn't know which Python virtualenv to use if there there are multiple python projects opened #25134
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Jun 1, 2025 - assigned and unassigned
on Jun 2, 2025 - removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Jun 2, 2025 - addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Jun 2, 2025 Hi there! 👋
Thanks again for reporting this issue. Based on what you described, this appears to touch the same parts of our environment/activation logic that we’ve recently replaced in our new Python Environments extension. A lot of the behavior in this area now follows a completely different activation and environment-resolution path, so this may already be fixed.
We’d really appreciate it if you could try the new extension and let us know—this helps us confirm that the new implementation addresses older issues like yours.
👉 Enable the new extension with
"python.useEnvironmentsExtension": true(then you should see aPythonicon in the sidebar.
📫 More details on enablement here
📝 Useful background documentation on activation hereIf you do run into issues, please include as much info and reproduction steps or the "Report issue..." command inside VS Code!
Thanks again for reporting this originally, and for helping us validate the new environment direction for Python in VS Code 🙌
- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Dec 12, 2025 Eleanor Boyd (@eleanorjboyd) Thank you for your reply.
"python.useEnvironmentsExtension": truebreaks pylance completelySteps to reproduce
- Have a virtualenv created via the CLI as you normally create virtualenvs and install some dependencies in via pip
- Now tell VSCode to use the environment, all works well so far
- now go to settings, add
"python.useEnvironmentsExtension": trueand restart vscode - You'll see many errors such as
Also VSCode will complain about every library you installed in the virtualenv, if you installed numpy for example and you try to import it, it will say not found. Pylance is completely broken.
Remove
"python.useEnvironmentsExtension": truefrom the settings and restart VSCode, everything goes back to normal."python.useEnvironmentsExtension": trueis literally unusable at this stage. I don't know how it was written and what kind of testing it went through. Didn't anyone try to use it with Pylance before shipping to production? Or does it work exclusively withuvand hasn't been tested with the traditional virtualenv and pip? I have no idea.- removedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Dec 13, 2025 - addedbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
on Dec 18, 2025 I have the same issue - on a mac. I have a folder workspace project with multiple subfolders each with their own virtual environment and dependencies. When I click to 'Select Interpreter' - my venvs are not listed. When I select to 'Find interpreter' and navigate to only of my venv /bin/python - nothing happens.
WORKAROUND that helped me was creating a
[my-root-project].code-workspacefile that tells vscode to treat your list of folders as if they were root folders. The trick is to then find this .code-workspace file in your file explorer and click on that to open up a new VSCode. This allowed vscode to understand which venv's had which dependencies and enabled me to move one. However - it would have saved me a lot of time I needed today if I could just select my interpreter.{ "folders": [ { "name": "BLAST", "path": "services/blast" }, { "name": "CODON-TRANSFORMER", "path": "services/codon-transformer" }, { "name": "ROOT", "path": "." } ], "settings": { "python.terminal.activateEnvironment": true } }nwheatleKite thank you, this works but you first have to open the project as a separate for venv to work correctly, if you start a new project with new venv inside a workspace, it will still not be detected correctly.
So you have to open it in a new folder, make sure that venv works, then open it again in the workspace.
- removedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Mar 13, 2026 🤖 Thanks for the additional context. Environment selection now uses the Python Environments extension by default, but the original two-window problem has not yet been confirmed on that current path. Could you retry the original project A/project B steps on the latest Python and Python Environments extensions and attach the output from Python: Report Issue, including the Python and Python Environments output-channel logs from project B after it opens with the wrong interpreter? Issues marked
info-neededare automatically closed after 30 days without a reply.- addedinfo-neededIssue requires more information from posterIssue requires more information from poster
on Sep 23, 2026
I'm using Windows 11 latest update, Vscode latest version, Python version 3.13.3, I'm using pip and vrtualenv, not uv. I don't use uv. I have ruff extension and pylance extensions for Python installed.
To reproduce this bug
Create a python project A, with virtualenv and install some dependencies, and set VScode to use the virtualenv you created by changing the Python interpreter in Vscode.
Create a python project B, with virtualenv and install some different dependencies, and set VScode to use the virtualenv you created by changing the Python interpreter in Vscode.
close all Vscode instances
Open now project A in VSCode, everything works fine
Keep project A open, create a new vsode window, ctrl + shift + n then open project B
Now you'll notice Vscode complaining about some pip dependencies missing from project B, that's simply because vscode is still connected to project A virtualenv, you'll have to switch the interpreter for project B manually by selecting the correct virtualenv.