Python select interpreter not found VS Code
Asked Answered
K

7

17

I started using venvs on Visual Studio Code, and when I am trying to use pandas, by import pandas

it gives me this error

"Import "pandas" could not be resolved from source"

So I tried to use ctrl+shift+p to change python interpreter in vscode, I get this error

"Command Python resulted in an error (comand 'python.setInterpreter' not found).

Kindergartner answered 7/4, 2022 at 2:54 Comment(1)
I am also facing this issue in the remote development. Plugin reinstalled. Spotted 2024-01-05 10:52:01.448 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-python.python' wants API proposal 'registerIssueDataProvider' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned. in the Output -> Window, but no idea if that's related.Frascati
K
46

For me, shifting from restricted mode to trusted window mode worked.

Just click on the restricted window on the bottom and just select "Trust" in the pop up window.

https://code.visualstudio.com/docs/editor/workspace-trust#_extensions

Knit answered 26/9, 2022 at 5:47 Comment(3)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Footlocker
Click on the python extension via the extension window then you'll probably see restricted on the footer bar below the area of the screen that scrolls. It's towards the left side. Click it and it will give you the option to go use trusted modeKitkitchen
Thank you, this was the answer for me as well!Meir
P
4

In my case, I solve it by clicking the "Extensions" button in the left sidebar of VSCode and "Reload" python. (which will show a blue reload button in the lower left corner of Python's block, just click it)

It works for me!!

Placard answered 11/2, 2023 at 9:48 Comment(0)
N
2

I suggest 2 ways to fix this, first uninstalling and reinstalling the extensions. On Linux (and MacOS I believe), deleting ~/.vscode/extensions/ and then manually reinstalling will help. If that does not work you can try manually setting the python interpreter (see: vscode documentation on manually specifying an interpreter).

For more information, I recommend you to look through How to start debugging Python 3.6 in Visual Studio Code?

Near answered 7/4, 2022 at 3:11 Comment(0)
M
2

In my case, i just reinstall the python extension from microsoft then reload the vscode.

image

Mimimimic answered 7/9, 2023 at 17:25 Comment(0)
F
1

I was able to fix this issue by adding below details in settings.json of vscode.

"python.venvFolders" : <Your venv folders>
"python.venvPath" : <Your Python path>

Functional answered 29/11, 2023 at 6:53 Comment(0)
F
0

In my case this happened when usig Remote SSH extension and doing Python development on a remote server. The issue was caused by Datadog agent that corrupted any application on the server.

Frascati answered 5/1 at 10:27 Comment(0)
K
0

In my case, none of the above described solutions worked.
I updated the VS code and reloaded the window and that resolved the issue.

Current VS code version is 1.85.2.

Keppel answered 22/1 at 4:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.