Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Python SDK in PyCharm

Tags:

python

pycharm

Since this morning, I'm no longer able to run projects in PyCharm.

When generating a new virtual environment, I get an "Invalid Python SDK" error. Cannot set up a python SDK at Python 3.11... The SDK seems invalid.

What I noticed: No matter what base interpreter I select (3.8, 3.9, 3.10) Pycharm always generates a Python 3.11 interpreter.

I did completely uninstall PyCharm, as well as all my python installations and reinstalled everything. I also went through the "Repair IDE" option in PyCharm. I also removed and recreated all virtual environments.

When I run "cmd" and type 'python' then python 3.10.1 opens without a problem.

This morning, I installed a new antivirus software that did some checks and deleted some "unnecessary files" - maybe it is related (antivirus software is uninstalled again).

like image 780
user7431005 Avatar asked Sep 13 '25 06:09

user7431005


2 Answers

I had the same problem on Linux. Solved it by invalidating caches as suggested here: https://stackoverflow.com/a/45099651/3990607

In pycharm click on File menu, then choose Invalidate caches..., tick all 4 boxes and then restart PyCharm. Solved the problem for me.

like image 156
patapouf_ai Avatar answered Sep 14 '25 21:09

patapouf_ai


Dealt with the same issue despite using python and pycharm without issue for months. Recently kept giving me the error despite changing the PATH variable of my system and even manually pathing within pycharm. After hours of reinstalling pycharm, python and even jumping around versions with no success it turned out it was because my python directory had a space in it that it just randomly decided to break.

For anyone who has tried what seems like everything to no avail ensure that NO part of the path to your python directory contains spaces

like image 34
Resident Hill Avatar answered Sep 14 '25 19:09

Resident Hill