17

Recently I reinstall my VS Code due to some errors. But I am not able to compile python files. I have installed all necessary extensions like python and code runner. But still I am getting this:

enter image description here

Tanishka
  • 401
  • 1
  • 6
  • 22

15 Answers15

12

Same problem occurred to me! All I did was just disabled and then re enabled the python extension again. OR Please uninstall the extension, restart VS Code, and then install it again. This error is symptomatic of an extension install going badly.

Akhilesh Magdum
  • 324
  • 2
  • 13
6

I tried everything to fix this problem

1.Unistall VS Code.

2.Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.

3.Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.

4.Restart you laptop and install VS Code again.

5.Install the python extension.

Yes they solve my other errors related to VS Code but this particular error was in my folder from which I was running my python program because when I execute some other python program saved in some other directory it worked successfully.

So I would suggest that you may try running your .py file by placing it in some new folder.

Tanishka
  • 401
  • 1
  • 6
  • 22
  • 1
    The other answers about uninstalling Pylance and Python extensions and then reinstalling them is a better solution than "nuke everything and start over". – Jeremiah Payne Aug 09 '21 at 04:02
2

I've just had exactly the same issue. My intellisense wouldn't work too. Tried everything.. at the end I've downgraded Jupyter version. Went back to version from 6 days ago and everything is working. Python, Pylance, Intellisense extensions are the newest.

Jakub
  • 303
  • 2
  • 8
2

one of the solutions is you should downgrade python extension to lower extension. please click extensions icon then choose manage button below python extension.and click install another version. then choose older version.then select interpreter(ctrl+shift+p). at the end restart vscode and run python file.

enter image description here

Help Link How to Downgrade Extension

Amin Golmahalleh
  • 3,585
  • 2
  • 23
  • 36
1

Just Update or Uninstall and Reinstall Pylance and Python extension from Extensions...and Restart VSCode....

Justin
  • 11
  • 1
0

You may need to roll back the VS Code Python extension temporarily.

See command 'python.execInTerminal-icon' not found #3003.

jarmod
  • 71,565
  • 16
  • 115
  • 122
0

Same problem. My solution is downgrade both Jupyter and Python to 2021.3.6xxx from current 2021.5

Version: 1.56.1 (user setup) Commit: e713fe9b05fc24facbec8f34fb1017133858842b Date: 2021-05-06T10:08:05.141Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.19041

Jeb50
  • 6,272
  • 6
  • 49
  • 87
0

Even I had the same problem but I fixed it. To fix this you have to delete VS Code completely and then reinstall it. Follow the steps:

  1. Unistall VS Code.

  2. Go to "C:/Users/{Whatever User}" and delete the .vscode Folder.

  3. Go to "C:/Users/{Whatever User}/AppData/Roaming" and delete the "Code" Folder. This file stores all the VS Code Cache.

  4. Restart you laptop and install VS Code again.

  5. Install the python extension.

This worked for me. Hope it helps you too.

Note: If you don't find the AppData folder in you users folder, you have to enable hidden items by going to the view section in the windows explorer taskbar.

azec-pdx
  • 4,790
  • 6
  • 56
  • 87
Anonymous
  • 9
  • 2
0

I was too lazy to follow the recommendations for reinstalling the program on the computer, so I went into the VSC extensions, uninstalled Python, restarted VSC, installed Python, restarted VSC and everything works now. If you are as lazy as I am, then you can try this method before taking drastic measures.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

Just uninstall python extension and then restart VS Code and then install python extension again and then you will not get this error anymore.

azec-pdx
  • 4,790
  • 6
  • 56
  • 87
0

Just update or reinstall Pylance and Python extensions and restart VS Code.

azec-pdx
  • 4,790
  • 6
  • 56
  • 87
0

Go to the python extension, hit the arrow next to uninstall and downgrade

Jad Sakr
  • 11
  • 1
0

I Tried uninstall Reinstall VS Code Windows 10 64 bit Not Worked. Just Uninstall all extensions in VS code.

1.open any .py file

2.Then VS CODE will show automatically to install python extension.

3.Install It Now you can see the interpreter without any issue.

NOTE:(Tried uninstalling reinstalling Extensions one by one not solved the issue)

Ole Pannier
  • 3,208
  • 9
  • 22
  • 33
Ohm Dios
  • 43
  • 1
  • 5
0

Same here. No I've tried to relaunch VS Code, but still no python, no terminal at all (neither "Code", "Problems", or other tabs), not even was able to load the extensions menu to reinstall python. But Relaunching the PC solved the issue :)

-2

Just uninstall VS Code, go to C:\Users\whatever user\ and delete .vscode.

Restart pc and install latest version of VS Code.

azec-pdx
  • 4,790
  • 6
  • 56
  • 87
  • This answer doesn't provide much value if the machine restart is required to get the python version working. – azec-pdx Jun 11 '21 at 19:28