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
{{ message }}
Repository navigation
Python extension does not detect Python installations and throws an error #16394
changed the title [-]Python extension does not detect Python installations and throws and error[/-][+]Python extension does not detect Python installations and throws an error[/+]on Jun 4, 2021
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?
Can you try installing an older version of the extension (for example 2020.4.58038), and see if your problem happens?
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
It used to work fine until a few weeks ago. I have tried a bunch of older version of the python extension without success, it's till reporting Python is not installed and not showing anything in the interpreter version in the status bar even when I select a new virtual env or point it to the system python installation.
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.
Microsoft Windows [Version 10.0.17763.1935]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\mlodozk\AppData\Roaming\Code\User>& c:/repos/automated-regression-testing/pysystemtests/.env/Scripts/Activate.ps1
& was unexpected at this time.
C:\Users\mlodozk\AppData\Roaming\Code\User>
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.
It seems the error has something to do with this path c:\Users\mlodozk\.vscode\extensions\ms-python.python-202. Can you move "c:\Users\mlodozk\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py" out in some other location and then run
"C:\Program Files\Python39\python.exe" "new location of pyvsc-run-isolated.py" "c:\Users\mlodozk\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\interpreterInfo.py"
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 C:\WINDOWS\System32\cmd.exe) Once you do that I expect the extension to start working.
As for the powershell issue, that is something you'll need to find a fix for yourselves as it's unrelated to the extension.
Activity
[-]Python extension does not detect Python installations and throws and error[/-][+]Python extension does not detect Python installations and throws an error[/+]karthiknadig commentedon Jun 4, 2021
Can you run this and share what you get?
kwmlodozeniec commentedon Jun 7, 2021
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.
kwmlodozeniec commentedon Jun 9, 2021
Is there anything else I could try to help debug the issue?
karrtikr commentedon Jun 9, 2021
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?
Can you try installing an older version of the extension (for example
2020.4.58038), and see if your problem happens?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...":
kwmlodozeniec commentedon Jun 9, 2021
My powershell version is 7.1.3
It used to work fine until a few weeks ago. I have tried a bunch of older version of the python extension without success, it's till reporting Python is not installed and not showing anything in the interpreter version in the status bar even when I select a new virtual env or point it to the system python installation.
kwmlodozeniec commentedon Jun 9, 2021
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.
karrtikr commentedon Jun 9, 2021
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.
kwmlodozeniec commentedon Jun 10, 2021
I tried the following insiders version and it still says Python is not installed.
karrtikr commentedon Jun 15, 2021
As we can't pinpoint the source, let's try a few things:
cmd(Can you verify this using https://nodejs.org/api/child_process.html#child_process_default_windows_shell ?). Please paste your User settings which contain certainterminalsettings impacting the shell type.python.exe" �[96m"c:\Users\mlodozk\.vscode\extensions\ms-python.python-202�[0mandIt seems the error has something to do with this path
c:\Users\mlodozk\.vscode\extensions\ms-python.python-202. Can you move"c:\Users\mlodozk\.vscode\extensions\ms-python.python-2021.5.842923320\pythonFiles\pyvsc-run-isolated.py"out in some other location and then runin powershell and see if the error goes.
kwmlodozeniec commentedon Jun 16, 2021
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.
karrtikr commentedon Jun 16, 2021
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
C:\WINDOWS\System32\cmd.exe) Once you do that I expect the extension to start working.As for the powershell issue, that is something you'll need to find a fix for yourselves as it's unrelated to the extension.
kwmlodozeniec commentedon Jun 18, 2021
Thanks for that, correcting the comspec fixed my issue with the extension!
karrtikr commentedon Jun 18, 2021
Great, closing this.