Skip to content

Allow disabling of interpreter auto-selection #15975

Closed

Description

Environment data

  • VS Code version: 1.55.2
  • 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:

Code_6T961dElFB

Expected behaviour

Newly created projects should have no interpreter & vscode should show Select Python Interpreter on the statusbar
no-interpreter-selected-statusbar

Actual behaviour

Newly created projects select my conda project auth0-python-web-app (an environment from a unrelated project).

Code_4LZ3DYt8zJ

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

  1. Create a new directory
  2. File > Open Folder... > Select newly created folder
  3. Create a *.py
  4. 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.

Activity

  1. kimadeline commented on Apr 19, 2021

    @kimadeline

    Hi Aaron N. Brock ☂️ (@AaronNBrock),

    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 " ".

  2. AutomateAaron commented on Apr 21, 2021

    @AutomateAaron
    Author

    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~

  3. kimadeline commented on May 5, 2021

    @kimadeline

    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:

    "python.experiments.optInto": [
            "DeprecatePythonPath - experiment"
        ],

    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.

  4. changed the title [-]VSCode automatically selecting random conda environment[/-] [+]Allow disabling of interpreter auto-selection[/+] on May 5, 2021
  5. locked and limited conversation to collaborators on May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-environmentsFeatures relating to handling interpreter environmentsfeature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions