You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vscode doesn't know which Python virtualenv to use if there there are multiple python projects opened #25134
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.
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 a Python icon in the sidebar.
📫 More details on enablement here
📝 Useful background documentation on activation here
If 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 🙌
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": true and 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": true from the settings and restart VSCode, everything goes back to normal.
"python.useEnvironmentsExtension": true is 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 with uv and hasn't been tested with the traditional virtualenv and pip? I have no idea.
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-workspace file 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.
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.
🤖 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-needed are automatically closed after 30 days without a reply.
Activity
eleanorjboyd commentedon Dec 12, 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 here
If 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 🙌
elieobeid7 commentedon Dec 13, 2025
Eleanor Boyd (@eleanorjboyd) Thank you for your reply.
"python.useEnvironmentsExtension": truebreaks pylance completelySteps to reproduce
"python.useEnvironmentsExtension": trueand restart vscodeAlso 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.nwheatleKite commentedon Feb 5, 2026
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.elieobeid7 commentedon Mar 1, 2026
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.
eleanorjboyd commentedon Sep 23, 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.