vscode-python: command 'python.setInterpreter' not found
Environment data
- VS Code version: 1.52.0 (user setup)
- Extension version (available under the Extensions sidebar): 2020.11.371526539
- OS and version: Windows_NT x64 10.0.18363
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.12 Anaconda
- 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: just Python extension: 2020.11.371526539
- Value of the
python.languageServer
setting: Jedi
[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
After doing CTRL+SHIFT+P, I want to select Python Interpreter
Actual behaviour
Command ‘Python: Select Interpreter’ resulted in an error (command ‘python.setInterpreter’ not found) So I cannot run any python scripts within vscode
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- I just start my vscode normally like I always do but suddenly I can’t see any python interpreter selected and cannot run my python scripts. So I tried to do CTRL+SHIFT+P to select it but it gave me this error. I didn’t update my Python recently also, but VSCode seems to have updated recently?
Logs
How can I retrieve detailed logs?
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 36 (12 by maintainers)
@bharel Try the following. If that does not help create a new bug.
Do the following to remove stale versions of the extension:
%USERPROFILE%/.vscode/extensions
(on windows) or~/.vscode/extensions
on Linux/Mac.ms-python.python*
It’s likely that the Python extension has not been activated. Please open a python file to activate the extension, the commands should be available after that.
Same issue here. I’m running code-server, its a totally clean install onto a clean install of Ubuntu Server 20.04 so I can 100% rule out any issues with multiple versions of the extension. Python is, quite literally, the first and only extension I have ever installed. I installed it from the built in extension page and all prerequisites are installed.
Here’s the info from Help > About
code-server: v3.8.1
VS Code: v1.51.1
Commit: 41ad0c0c4c14df78e1bfa3a44d8b633ed2fc26e5
Date: 2021-02-05T22:26:25Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Edit - Fixed but I had to roll the python extension all the way back to v2020.10.332292344
Yep. I installed v2020.10.332292344 (from 1 month ago) and everything is back to normal. Seeing as the issue started happening yesterday, it’s most likely something to do with the new release that came out on 14th Dec, but then someone else posted this on 7 Nov also so maybe that one already has the issue.
https://stackoverflow.com/questions/64723778/vscode-using-the-ms-python-extension-cannot-execute-code
When I had the same problem, my problem was because of the jupyter that the python extension needs, I just updated it and it worked.
Same problem here with
code-server v3.9.0
. I have deleted allms-toolsai.jupyter.*
andms-python.python.*
from the extension folder.I have re-installed
ms-toolsai.jupyter
from the marketplace, current version v2021.2.0. I have re-installed 'ms-python.python` from the marketplace, current version v2021.2.582707922.I have opened a python file, and run “Python: Select Interpreter”. I got this error:
Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)
I have no Python value in the drop-down in the Output panel to display any logs.
About my local python versions (I don’t know if it helps), i ran this in the vscode terminal tab:
Solution: I have to reverted back
ms-python,python
to version 2020.10.332292344@karthiknadig I’ve installed VS code 4 days ago, on a fresh system. I’m not sure I have a “stale version”. I did install an older extension version though and it solved the problem. @linminhtoo did that as well and it worked for him.
@linminhtoo Are you by chance installing using VSIX manually? if so, can you verify you also have
ms-toolsai.jupyter
(https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) extension installed. it is needed for the python extension to work.@linminhtoo Can you check the following folder
%USERPROFILE%\.vscode\extensions
and see if there are multiplems-python.python*
versions? If so remove all of them.Also can you check your settings, are you using
"python.experiments.optInto": [ "All"]
setting?Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue’s priority.
If you think your issue is more of a question or configuration problem rather than a bug, please ask on Stack Overflow with the
visual-studio-code
andpython
labels for help.Thanks for your understanding and patience!