Skip to content

python.DefaultInterpreterPath not respected in multi-root workspace. #18207

Closed
@urscion

Description

@urscion

VS Code version

1.63.2

Extension version

v2021.12.1559732655

OS type

Windows

OS version

19043.1348

Python distribution

python.org

Python version

3.9.1

Language server

Pylance

Expected behaviour

When I set python.defaultInterpreterPath in my workspace configuration file, the Python extension should use that interpreter.

Actual behaviour

The "Choose a Python Interpreter" selection is shown and no interpreter has been selected.

image

Steps to reproduce

code-workspace settings file

{
    "settings": {
        "python.defaultInterpreterPath": "${workspaceFolder}/.virtualenvs/mtg_39_64/Scripts/python.exe",
    }
}

When attempting to clear the workspace interpreter setting (off a fresh restart) and resetting it via the command palette prompts, it does not work either.
image
image

Logs

And these are the results of my Python output. It appears to be not respecting the pre-defined ${workspaceFolder} variable. However, I've tried an absolute path as well, as well as my system-level Python paths and they do not work either (but no scandir errors are displayed).

Results

Experiment 'pythonaa' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'pythonSurveyNotificationcf' is active
Experiment 'PythonPyTorchProfiler' is active
Experiment 'pythonDeprecatePythonPath' is active
> conda info --json
> "C:\Program Files\Python39\python.exe" ~\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\interpreterInfo.py
> "C:\Program Files\Python38\python.exe" ~\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\interpreterInfo.py
> ~\git\bitbucket\virtualenv\mtg_38_64\Scripts\python.exe -c "import sys;print(sys.executable)"
> ~\.virtualenvs\django-tutorial_39_64\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\interpreterInfo.py
> ~\.virtualenvs\ugit_39_64\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\interpreterInfo.py
> ~\git\bitbucket\virtualenv\mtg_38_64\Scripts\python.exe -c "import sys;print(sys.executable)"
Starting Pylance language server.
> ~\git\bitbucket\virtualenv\mtg_38_64\Scripts\python.exe -c "import sys;print(sys.executable)"
[ERROR 2021-11-19 16:25:49.126]: Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
> conda --version
> ~\git\bitbucket\virtualenv\mtg_38_64\Scripts\python.exe -c "import sys;print(sys.executable)"
> ~\git\bitbucket\virtualenv\mtg_38_64\Scripts\python.exe -c "import sys;print(sys.executable)"
[ERROR 2021-11-19 16:27:12.152]: Python Extension: sendTelemetry [Error: ENOENT: no such file or directory, scandir 'C:\Users\Peter\AppData\Local\Programs\Microsoft VS Code\${workspaceFolder}\.virtualenvs\mtg_39_64\Scripts'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'scandir',
  path: 'C:\\Users\\Peter\\AppData\\Local\\Programs\\Microsoft VS Code\\${workspaceFolder}\\.virtualenvs\\mtg_39_64\\Scripts'
}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions