Skip to content

"No Python interpreter is selected" notification on almost every start on WSL #16419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rulerofthehuns opened this issue Jun 8, 2021 · 5 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug

Comments

@rulerofthehuns
Copy link

Environment data

  • VS Code version: 1.56.2
  • Extension version (available under the Extensions sidebar): v2021.5.842923320
  • OS and version: Windows 10, 19043.985
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7
  • 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: "Pylance"

[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]

Expected behaviour

Store selected interpreter when switching between VSCode on Windows/WSL.

Actual behaviour

"No Python interpreter is selected" notification displayed every time after switching between Windows/WSL

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Start cmd, and change to a directory with a python file in in: `cd c:\work\test'
  2. Start VSCode: code .
  3. In VSCode, open a pyhton file, "No Python interpreter is selected" notification may be displayed, select an interpreter.
  4. Close VSCode, reopen with same command: no notification, works as expected.
  5. Open the same directory in VSCode in WSL: wsl code .
  6. Open a python file, "No Python interpreter is selected" notification will be displayed, select an interpreter.
  7. Close and reopen vscode in WSL: no notification, works as expected.
  8. Start VSCode without WSL: code .
  9. "No Python interpreter is selected" notification is displayed: THIS IS NOT THE EXPECTED BEHAVIOUR, python interpreter was already selected.
  10. Select interpreter anyway, close VSCode, and open in WSL: wsl code .
  11. "No Python interpreter is selected" notification is displayed: THIS IS NOT THE EXPECTED BEHAVIOUR, python interpreter was already selected.

Logs

Logs after starting in Windows with WSL interpreter already selected:

User belongs to experiment group 'pythonaacf'
User belongs to experiment group 'pythonJediLSP'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'pythonSurveyNotificationcf'
User belongs to experiment group 'PythonPyTorchProfiler'
User belongs to experiment group 'ShowExtensionSurveyPrompt - control'
User belongs to experiment group 'CollectLSRequestTiming - experiment'
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Starting Pylance language server.
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Error 2021-06-08 09:15:51: 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.
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py pylint --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\work\tst\test.py
cwd: c:\work\tst
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py pylint --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text c:\work\tst\test.py
cwd: c:\work\tst
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import pylint"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import pylint"

Linter 'pylint' is not installed. Please install it or select another linter".
Error: spawn /usr/bin/python3 ENOENT
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"

@rulerofthehuns rulerofthehuns added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Jun 8, 2021
@karrtikr
Copy link

karrtikr commented Jun 8, 2021

Potential dup of #16291. Can you add the setting mentioned here #16291 (comment) in Remote and User settings and see if it helps?

@karthiknadig karthiknadig added triage area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Jun 8, 2021
@karrtikr karrtikr added the info-needed Issue requires more information from poster label Jun 8, 2021
@karrtikr
Copy link

karrtikr commented Jun 8, 2021

If you see in the logs, we're unable to verify that the python interpreter is valid and the error Error: spawn /usr/bin/python3 ENOENT is being thrown. Can you run that command in WSL terminal and see if it works?

/usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"

@rulerofthehuns
Copy link
Author

If you see in the logs, we're unable to verify that the python interpreter is valid and the error Error: spawn /usr/bin/python3 ENOENT is being thrown. Can you run that command in WSL terminal and see if it works?

/usr/bin/python3 c:\Users\<USERNAME>\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"

Yes, it works, if I change the path to unix style, but please note that this error occurred when I've started VSCode in Windows version, not WSL.

$ /usr/bin/python3 /c/Users/<USERNAME>/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
/usr/bin/python3

@rulerofthehuns
Copy link
Author

Potential dup of #16291. Can you add the setting mentioned here #16291 (comment) in Remote and User settings and see if it helps?

It does not seem to have any effect.

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Jun 9, 2021
@karrtikr
Copy link

I'm able to reproduce this, thanks. Your issue should be fixed with #17732. We have opened #17667 to improve the prompt message.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants