-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Python extension does not detect Python installations and throws an error #16394
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
Comments
Can you run this and share what you get?
|
Okay, I have run the above in powershell and this is where I get the issue. The standard cmd gives me this:
But this was working absolutely fine until now. |
Is there anything else I could try to help debug the issue? |
We'll need to fix the error with powershell, it could be it's not able to parse certain unicode characters. What's the version of powershell you were using? Did it ever used to work with the extension? You can follow the prompts from "Extensions: Install Specific Version of Extension..." in the command palette: Or you can open the extensions side bar, click on the settings for the Python extension and pick "Install Another Version...": |
My powershell version is 7.1.3 |
I even tried changing the default shell to cmd and VS Code is still trying to load the PS script activation file. Could that be a clue? I have changed the default shell to PS a few weeks ago, but I seem to remember it was working.
|
Oh I see, VSCode recently had a issue #16175 where the API was unable to detect the correct shell. Can you try VSCode insiders as mentioned here #16175 (comment) and see if it helps? Either way, it seems the issue is either with powershell or VSCode, but not the extension itself as rolling back doesn't work. |
I tried the following insiders version and it still says Python is not installed.
|
As we can't pinpoint the source, let's try a few things:
It seems the error has something to do with this path
in powershell and see if the error goes.
|
I think I have fixed that issue with VSCode defaulting to PS by removing my settings and adding them again. But here are my terminal related settings.
|
Thanks for the info, this helps!
So you have selected your default shell as powershell, we'll need to change that to cmd. Set the environment variable to contain the full path to cmd instead. (It's probably As for the powershell issue, that is something you'll need to find a fix for yourselves as it's unrelated to the extension. |
Thanks for that, correcting the comspec fixed my issue with the extension! |
Great, closing this. |
Environment data
python.languageServer
setting: PylanceExpected behaviour
The extension should correctly detect the installed python version without errors.
Actual behaviour
Extension fails to detect Python and throws an error in the output.

Steps to reproduce:
Logs
Python extension output
The text was updated successfully, but these errors were encountered: