Skip to content

Fix support for folders in python.pythonPath setting #15782

@meakbiyik

Description

@meakbiyik

Environment data

  • VS Code version: 1.54.3
  • Extension version (available under the Extensions sidebar): v2021.3.680753044
  • OS and version: Windows 10.0.19041
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv (via poetry)
  • Value of the python.languageServer setting: Pylance

Expected behaviour

For "python.pythonPath": "${workspaceFolder}/.venv" workspace setting, extension is expected to find the virtualenv in the given directory.

Actual behaviour

The extension is unable to find the virtual env with the latest update (rolling back to the previous version works fine).

Steps to reproduce:

  1. Create a virtualenv in the workspace possibly using poetry, and point to the workspace with ${workspaceFolder}/{workspace_name}

IMPORTANT NOTE: ".venv\\Scripts\\python.exe" works fine, but "${workspaceFolder}\\.venv", "${workspaceFolder}/.venv" does not. All of them works in the previous version.

Possibly related to #15781 but I do not have the error described in that issue in the output below.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonJoinMailingListVar2'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonFindInterpreter'
User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled'
User belongs to experiment group 'CollectLSRequestTiming - control'
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Starting Pylance language server.
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> c:\Users\erena\OneDrive\Desktop\SNLab\soccerbars/.venv c:\Users\erena\.vscode\extensions\ms-python.python-2021.3.680753044\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Error 2021-03-25 12:24:27: 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.

Metadata

Metadata

Assignees

Labels

area-environmentsFeatures relating to handling interpreter environmentsbugIssue identified by VS Code Team member as probable bugregressionBug didn't exist in a previous release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions