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
Allow disabling of interpreter auto-selection #15975
Extension version (available under the Extensions sidebar): v2021.3.680753044
OS and version: Windows 10, using WSL 2
Python version (& distribution if applicable, e.g. Anaconda): 3.9 (but should be irrelevant to this issue)
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Relevant/affected Python packages and their versions: N/A
Relevant/affected Python-related VS Code extensions and their versions: N/A
Value of the python.languageServer setting: Not Set
[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]
Background
Nowhere in my vscode settings (user, remote, or workspace) do I define a python.pythonPath (nor python.defaultInterpreterPath), the setting is completely empty:
Expected behaviour
Newly created projects should have no interpreter & vscode should show Select Python Interpreter on the statusbar
Actual behaviour
Newly created projects select my conda project auth0-python-web-app (an environment from a unrelated project).
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
This is for me to reproduce
Create a new directory
File > Open Folder... > Select newly created folder
Create a *.py
VSCode selects my auth0-python-web-app environment
Other notes
Restarting VS code doesn't resolve this
If I delete the selected conda environment (in this case auth0-python-web-app), vscode will start autoselecting a different conda environment. I can't figure out how it determines which one it selects.
The environment auto-selection proceeds as follows:
Select the environment with the latest Python version, and
Pick the first one in alphabetical order.
If you want to get the "Select Python Environment" prompt on the status bar, you can set python.defaultInterpreterPath to a bogus value, for example " ".
However since your ask is to find a way to disable interpreter auto-selection, I am going to switch this to a feature request and mark this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes your idea gets to help us make our decision, so feel free to upvote the initial post to help us prioritize it.
Activity
kimadeline commentedon Apr 19, 2021
Hi Aaron N. Brock ☂️ (@AaronNBrock),
The environment auto-selection proceeds as follows:
If you want to get the "Select Python Environment" prompt on the status bar, you can set
python.defaultInterpreterPathto a bogus value, for example " ".AutomateAaron commentedon Apr 21, 2021
Hey Kim-Adeline Miguel (@kimadeline),
I updating the the setting:
{ "python.defaultInterpreterPath": " " }However it's still automatically selecting a the other environment.
Also, is the functionality you describe here documented anywhere?
Thanks~
kimadeline commentedon May 5, 2021
Hi Aaron N. Brock ☂️ (@AaronNBrock), thank you for your patience!
This setting only works if you're in the DeprecatePythonPath experiment. Try adding this to your global
settings.json:It is documented in the wiki.
However since your ask is to find a way to disable interpreter auto-selection, I am going to switch this to a feature request and mark this issue as "needs decision" to make sure we have a conversation about your idea. We plan to leave this feature request open for at least a month to see how many 👍 votes your idea gets to help us make our decision, so feel free to upvote the initial post to help us prioritize it.
[-]VSCode automatically selecting random conda environment[/-][+]Allow disabling of interpreter auto-selection[/+]