You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
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.
Reacted by surfer190, Weikang Qiu, kshitijgundale, Antonio Malafronte, Fabian Herzog, Patrick Daniel, Luca and Will Barnes
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.
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.
I don't understand what you mean. I've been coding Python for months. This happened out of the blue one day when I was trying to execute .py scripts (normally there's the green arrow button on the top right as well), so I suspect the latest update caused the issue. I am trying to rollback to an older version of the extension.
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.
Lin Min Htoo (@linminhtoo) Can you check the following folder %USERPROFILE%\.vscode\extensions and see if there are multiple ms-python.python* versions? If so remove all of them.
Also can you check your settings, are you using "python.experiments.optInto": [ "All"] setting?
Lin Min Htoo (@linminhtoo) Can you check the following folder %USERPROFILE%\.vscode\extensions and see if there are multiple ms-python.python* versions? If so remove all of them.
Also can you check your settings, are you using "python.experiments.optInto": [ "All"] setting?
I deleted all folders of ms-python.python* and reinstalled the latest version of the Python extension (specifically 2020.12.424452561), but the same error returns when trying to select a Python interpreter. I also tried both ["All"] and just [] for "python.experiments.optInto" but both gave me the same error when trying to select a Python interpreter.
Karthik Nadig (@karthiknadig) Thank you, this was the issue for me. Can you please make it so that the extension gives some kind of error/warning that Jupyter package is missing? I've read all the logs and I couldn't find what was wrong before I googled the issue.
Same problem here with code-server v3.9.0.
I have deleted all ms-toolsai.jupyter.* and ms-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:
Read through all the posts. I am running Mojave on a MacBook Pro. My jupyter folder had the correct extension.js file. What seems really odd to me is I was using VSCode running a Python script a few weeks ago and everything was fine. But yesterday I went to run the same script and it failed. I haven't made any changes to my Python3 installation. Debugging led me to the error the interpreter was not loading and I noticed that it wasn't showing up in the bottom left of the status bar either (as others have reported). Reverting the ms-python.python extension to 2020.10.332292344 solved the issue. Any ideas why this is happening Lin Min Htoo (@linminhtoo) ?
ctphillips Check the developer console, and python logs. Developer console can be found here Help > Toggle Developer tools. and Python logs at Output > Python panel. If the extension did not load then you won't see Python in the possible options to select in the output panel.
Karthik Nadig (@karthiknadig) There is nothing in the Output > Python panel if I am looking in the correct location. I assume you mean the Output that can be reached by View -> Output. I also don't see anything in View -> Problems (It simply says "No problems have been detected in the workspace"). In the Help -> Toggle Developer tools I do see some errors and warnings. Interestingly, I see errors with v2020.10.332292344 (which eventually works) and v2021.2.636928669 (which doesn't work). In both cases, after opening vscode and it begins to load a python project, I get a warning in the bottom right of the workspace:
IntelliCode Python support requires you to use the Microsoft Python Language Server (preview)
When I click on the button: Enable it and Reload Window, the v2020.10 version loads the python interpreter and the v2020.2 never does.
Looking at the error log in the Developer Tools in v2020.2 (after enabling the Microsoft Python Language Server) I see the following errors:
IntelliCode Python support requires you to use the Microsoft Python Language Server (preview). onDidChangeNotification @ notificationsAlerts.ts:40
Cannot activate extension 'Python' because it depends on extension 'ms-toolsai.jupyter', which failed to activate. _logMessageInConsole @ abstractExtensionService.ts:718
Activating extension 'ms-toolsai.jupyter' failed: Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.. _logMessageInConsole @ abstractExtensionService.ts:718
[Extension Host] (node:81920) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. v @ console.ts:137
In addition to the errors there are 5 warnings 4 of which seem to be related to the same issue
[Extension Host] stack trace: Error: Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again. at w.reject (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:16717) at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:20787 at async w.doWriteConfiguration (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:13896) v @ console.ts:137
So I am wondering why the Extension Host is not able to write to the user settings. Maybe that is the root cause, which produces the errors?
Okay. In the end, most of these errors were due to a typo in my user settings file. :-(
It was causing the Language Server not to be loaded on start up, and also not able to update the user settings, when I clicked on the button to enable it and reload the window. Not sure why v2020.10 was able to work after the reload (even though the settings file was not written to) but the v2021.2 wasn't able to work. But the correct Python virtual environment is loading now with the v2021.2 Python extension.
There is still one warning and one error remaining the Developer Console, but I am not seeing an obvious effects of the problem.
warning: Overwriting grammar scope name to file mapping for scope source.java. Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/java/syntaxes/java.tmLanguage.json. New grammar file: file:///Users/cphillips/.vscode/extensions/redhat.java-0.76.0/syntaxes/java.tmLanguage.json
error console.ts:137 [Extension Host] (node:89391) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
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.
If 2020.10.* works but 2020.11.* onwards doesn't then that is due to missing this extension https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter. in 2020.11.1 we split the python extension into two, one that provides core python features and another that provide data science features.
Another thing is to ensure that everything is getting loaded correctly. VS Code recently had a problem where it would fail to extract the downloaded extension packages completely. Partial install meant that files were left out, and it shows as errors like python.setInterpreter not found. Check the developer console to see if there are any errors reported (Help > toggle developer tools to see it). Usually the error will point to some file (like extension.js) as module not found. Check if that file exists, path should be in the reported error.
For anyone running into this issue, if you are done the two things I mention above (install jupyter and there are not errors in developer console indicating missing files), then please file a separate bug.
Closing this, since this particular issue should be addressed by steps described here.
Activity
[-](command 'python.setInterpreter' not found)[/-][+]command 'python.setInterpreter' not found[/+]karrtikr commentedon Dec 14, 2020
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.
karthiknadig commentedon Dec 15, 2020
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-codeandpythonlabels for help.Thanks for your understanding and patience!
linminhtoo commentedon Dec 15, 2020
I don't understand what you mean. I've been coding Python for months. This happened out of the blue one day when I was trying to execute .py scripts (normally there's the green arrow button on the top right as well), so I suspect the latest update caused the issue. I am trying to rollback to an older version of the extension.
linminhtoo commentedon Dec 15, 2020
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
karthiknadig commentedon Dec 15, 2020
Lin Min Htoo (@linminhtoo) Can you check the following folder
%USERPROFILE%\.vscode\extensionsand 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?linminhtoo commentedon Dec 22, 2020
I deleted all folders of
ms-python.python*and reinstalled the latest version of the Python extension (specifically 2020.12.424452561), but the same error returns when trying to select a Python interpreter. I also tried both["All"]and just[]for"python.experiments.optInto"but both gave me the same error when trying to select a Python interpreter.karthiknadig commentedon Jan 4, 2021
Lin Min Htoo (@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.bharel commentedon Feb 7, 2021
Happens to me as well:
Command 'Python: Select Interpreter' resulted in an error (command 'python.setInterpreter' not found)Pylance language server, Python 3.9 (Trying to set a virtual environment).
karthiknadig commentedon Feb 8, 2021
Bar Harel (@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/extensionson Linux/Mac.ms-python.python*15 remaining items
rchiodo commentedon Feb 19, 2021
I'd delete that folder then and reinstall from the marketplace.
rchiodo commentedon Feb 19, 2021
Delete the entire extension folder that is.
vshargin commentedon Feb 20, 2021
Karthik Nadig (@karthiknadig) Thank you, this was the issue for me. Can you please make it so that the extension gives some kind of error/warning that Jupyter package is missing? I've read all the logs and I couldn't find what was wrong before I googled the issue.
Lestt commentedon Feb 23, 2021
Same problem here with
code-server v3.9.0.I have deleted all
ms-toolsai.jupyter.*andms-python.python.*from the extension folder.I have re-installed
ms-toolsai.jupyterfrom 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,pythonto version 2020.10.332292344karthiknadig commentedon Feb 23, 2021
Jonathan Clus (@Lestt) was there nothing in the dev tools Logs? (Help > Toggle Developer Tools)
ctphillips commentedon Mar 11, 2021
Read through all the posts. I am running Mojave on a MacBook Pro. My jupyter folder had the correct extension.js file. What seems really odd to me is I was using VSCode running a Python script a few weeks ago and everything was fine. But yesterday I went to run the same script and it failed. I haven't made any changes to my Python3 installation. Debugging led me to the error the interpreter was not loading and I noticed that it wasn't showing up in the bottom left of the status bar either (as others have reported). Reverting the ms-python.python extension to 2020.10.332292344 solved the issue. Any ideas why this is happening Lin Min Htoo (@linminhtoo) ?
karthiknadig commentedon Mar 11, 2021
ctphillips Check the developer console, and python logs. Developer console can be found here Help > Toggle Developer tools. and Python logs at Output > Python panel. If the extension did not load then you won't see Python in the possible options to select in the output panel.
ctphillips commentedon Mar 12, 2021
Karthik Nadig (@karthiknadig) There is nothing in the Output > Python panel if I am looking in the correct location. I assume you mean the Output that can be reached by View -> Output. I also don't see anything in View -> Problems (It simply says "No problems have been detected in the workspace"). In the Help -> Toggle Developer tools I do see some errors and warnings. Interestingly, I see errors with v2020.10.332292344 (which eventually works) and v2021.2.636928669 (which doesn't work). In both cases, after opening vscode and it begins to load a python project, I get a warning in the bottom right of the workspace:
IntelliCode Python support requires you to use the Microsoft Python Language Server (preview)When I click on the button: Enable it and Reload Window, the v2020.10 version loads the python interpreter and the v2020.2 never does.
Looking at the error log in the Developer Tools in v2020.2 (after enabling the Microsoft Python Language Server) I see the following errors:
IntelliCode Python support requires you to use the Microsoft Python Language Server (preview). onDidChangeNotification @ notificationsAlerts.ts:40Cannot activate extension 'Python' because it depends on extension 'ms-toolsai.jupyter', which failed to activate. _logMessageInConsole @ abstractExtensionService.ts:718Activating extension 'ms-toolsai.jupyter' failed: Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.. _logMessageInConsole @ abstractExtensionService.ts:718[Extension Host] (node:81920) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. v @ console.ts:137In addition to the errors there are 5 warnings 4 of which seem to be related to the same issue
[Extension Host] stack trace: Error: Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again. at w.reject (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:16717) at file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:20787 at async w.doWriteConfiguration (file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2013:13896) v @ console.ts:137So I am wondering why the Extension Host is not able to write to the user settings. Maybe that is the root cause, which produces the errors?
Thoughts? Next steps?
ctphillips commentedon Mar 12, 2021
Okay. In the end, most of these errors were due to a typo in my user settings file. :-(
It was causing the Language Server not to be loaded on start up, and also not able to update the user settings, when I clicked on the button to enable it and reload the window. Not sure why v2020.10 was able to work after the reload (even though the settings file was not written to) but the v2021.2 wasn't able to work. But the correct Python virtual environment is loading now with the v2021.2 Python extension.
There is still one warning and one error remaining the Developer Console, but I am not seeing an obvious effects of the problem.
warning:
Overwriting grammar scope name to file mapping for scope source.java. Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/java/syntaxes/java.tmLanguage.json. New grammar file: file:///Users/cphillips/.vscode/extensions/redhat.java-0.76.0/syntaxes/java.tmLanguage.jsonerror
console.ts:137 [Extension Host] (node:89391) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.hollyjrobertson commentedon Mar 14, 2021
Thank you for this version recommendation.
I downgraded from v2021.2.636928669 to v2020.10.332292344 - VS Code WORKS now!
Thank you!
karthiknadig commentedon Mar 14, 2021
If
2020.10.*works but2020.11.*onwards doesn't then that is due to missing this extension https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter. in2020.11.1we split the python extension into two, one that provides core python features and another that provide data science features.Another thing is to ensure that everything is getting loaded correctly. VS Code recently had a problem where it would fail to extract the downloaded extension packages completely. Partial install meant that files were left out, and it shows as errors like
python.setInterpreternot found. Check the developer console to see if there are any errors reported (Help > toggle developer tools to see it). Usually the error will point to some file (likeextension.js) as module not found. Check if that file exists, path should be in the reported error.For anyone running into this issue, if you are done the two things I mention above (install jupyter and there are not errors in developer console indicating missing files), then please file a separate bug.
Closing this, since this particular issue should be addressed by steps described here.
LuccasSousa commentedon May 11, 2021
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.