It used to work fine, but recently whenever I run my code (Python), I get the message "Shell Integration failed to activate" when I hover my mouse over the active terminal. The active Python terminal doesn’t recognize any command line commands like "pip" anymore (see screenshot)
What can I do? I played around with a couple of settings as described here, but nothing seems to work. My current setting.json file looks like this:
{
"python.defaultInterpreterPath": "C:\Users\cleme\AppData\Local\Programs\Python\Python310\python.exe",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"path": "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe",
"source": "PowerShell",
"icon": "terminal-powershell",
}
},
"terminal.integrated.defaultProfile.windows": "PowerShell"
}
2
Answers
I ended up deleting the whole Code folder within the C:UsersAppDataRoaming.
Note: You have to check the box – view Hidden Files to see these folders within File Explorer.
This solved it.
There must have been some weird corrupted cache issue at the heart of this.
I found this in C:Users<profile>AppDataRoamingCodelogs<datetimestamp>ptyhost.log
I think it is related to this.
BTW: I had tried adding a couple of PowerShell VSCode IDE Extensions when things went awry.
IIRC they were:
I had upgraded PowerShell to the latest version 7 too.
$PSVersionTable yielded the following from the respective executables.
Maybe that combo hosed things
Follow up note: Whilst it seemed to have fixed the issue once… soon after the problem manifested itself again. This time I couldn’t reset VS Code to a working environment.
.vscodesettings.json just contained this:
Again this ended up being a one time solution.
I ended up back at:
Shell activation failed to activate for cmd.exe
I posted this as a new ticket here
Closing VSCode, verifying that powershell works, then reopening it worked for me.