Invalid Python SDK in 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).
‘Invalid Python SDK Error while using python 3.4 on PyCharm
When I switch my PyCharm to use Python 3.4.3 I am getting the error:
Also PyCharm does not automatically find the Python 3.4 interpreter for me, even though it is on desired path /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 .

Although the interpreter does work. I am able to get correct output as expected, but code completion related to python 3.4 is not working.
e.g. print(«hello world!) still shows an error on the editor, but the console shows the correct output.
Solution 1: [1]
I had the same issue. Try to comment/remove the PYTHONPATH variable in your
If it does not help it also may be useful to look in the idea.log for the errors:
I had the following errors:
Solution 2: [2]
This also happened to me. I renamed a repository and then my virtual environment got stuck in the old path.
I grepped all configuration files and could not find any reference to the old one.
What finally solved the problem was to clear caches with the option File > Invalidate Caches / Restart. :

Solution 3: [3]
I go the same error message in Windows version of PyCharm after I re-installed Python (3.5) on a different location. The problem was that most of my existing virtual environments registered in PyCharm were still referencing the old installation of Python.
I resolved it by deleting these existing virtual environments and creating a new one. If deleting existing interpreters (in virtual environment) is not an option, you should be able to modify them instead in File | Settings | Project Interpreter
Solution 4: [4]
I got the same issue, when I updated Python (3.x) version via Home brew in MacOS. Above answers didn’t work for me. But with those, I realize that, it’s an issue with linking the directories. I deleted
/.virtualenvs folder and recreated all virtual envs.
Open the PyCharm again, and it works fine.
Solution 5: [5]
I couldn’t get anything to work, so I cloned my conda env (see how), called it something else, and then set it in PyCharm to the new one.
Solution 6: [6]
For me, changing the paths in
\venv\pyvenv.cfg made PyCharm recognize the new environment after bringing my projects to a new PC.
Solution 7: [7]
I solved the same problem by uninstalling and re-installing PyCharm. Try it. It’s waaaay simpler.
Solution 8: [8]
I had the same issue in Windows10. I was so frustrated, beacause everything seems looked OK. I’ve added PYTHONPATH, I’ve restarted Pycharm and deleted old virtualenv folders and created new. It did’t work.
And at the end I have just opened Pycharm in an administrator mode and it works!
Solution 9: [9]
When creating a new project my interpreter was set to python 2.7 so I had to change that to python3 and everything works like a charm
Solution 10: [10]
I got the same problem with Pop OS 21.04 and Pycharm installed via Flatpack. So i remove it and installed via Snap and started working again.
Solution 11: [11]
I ended up having to install Python as an admin and make sure it installed to the C:\Program Files\Python310 folder. I think The option was to make sure it installed for all users. If I installed it under for user’s appdata it wouldn’t work.
Once I did that I was able to point pycharm to the C:\Program Files\Python310\ for the interpreter. Pretty annoying but finally got it working
Solution 12: [12]
I’ve solved it too. Uninstalled python 3.10, installed python 3.9. Changed the python interpreter to 3.9 through pycharm setting. Created a new virtual environment.
Solution 13: [13]
I resolved the same issue easily. I just added the versión of python manually.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Issue
Some time ago I seriously crashed my Windows computer while using PyCharm — I remember some errors about memory and then a hard crash with no blue screen — just black with some thin vertical lines and reboot to Windows installation / fixing screen. Since then, I had this problem, with no way I found online to fix this.
Edit : Apparently, this has nothing to do with the problem.
The problem
Whenever I open a project, or create a new one, an error appears with the Invalid Python SDK error message.
Also, this is what the work environment looks like the moment I close this message. In the Project window, the venv directory (and every directory under it) is marked as an Exclusion, and in the code, the print(f’Hi,

What’s more, when I go to Python Interpreter settings at File -> Settings -> Project -> Python Interpreter there’s a yellow bar on the bottom which says:
which after some time says:
Python packaging tools not found.
Upon installing, nothing changes, and I can’t add packages from this screen (the ‘+’ button is greyed out):

When I try to check Python interpreter paths, there are no paths shown, and I don’t know what that means:

In short, all of the default Python functions like print are marked as errors, even though they work when executed. This makes coding extremely confusing, as I can’t quickly distinguish between real errors and ‘errors’.
The search for solution
Normally this would be a problem with interpreter set-up or path, but I’ve tried most of the methods proposed in other answers to similar questions. To name a few :
- PyCharm shows unresolved references error for valid code
- ‘Cannot setup a Python SDK’ in PyCharm project using virtualenv after OS reinstallation
- Why do I get an ‘SDK seems invalid’ error when setting up my Project Interpreter in PyCharm?
- Invalid Python SDK Error while using python 3.4 on PyCharm
- Invalid Python SDK when setting a venv
There were supposed to be links, but I don’t have enough reputation on Stack Overflow to post them with the questions. These, however, can be easily looked up in Google, all of them are posted to Stack Overflow.
What I tried
I should mention that the first things I tried were removing and installing PyCharm, all user configurations and Python itself as well. I installed Python from the official site, and from the PyCharm application, both methods ended with the same result.
- File -> Invalidate Caches. -> Invalidate and restart. Didn’t work.
- Checking file interpreter in Edit Configurations . Don’t know what to make of it. The result:

- Refreshing the interpreter paths. Even now, the paths yield no results.

- Removing the interpreter and adding it again. No result.
- Deleting the .idea folder. No result.
- Deleting PyCharm user preferences under %homepath%/.PyCharm50 . I don’t have that folder though.
- Switching interpreter back and forth. No result.
- Creating a new interpreter in a different location. No result.
- Marking project directory as root ProjectName -> Mark Directory as -> Sources Root and unmarking other directories as Excluded. No result.
- Using no interpreter. Yeah, it doesn’t mark non-errors as errors anymore. But the code doesn’t work. That’s not a solution for me.
- Checking if venv/pyvenv.cfg has paths set correctly. These look fine to me.

- Checking Windows environment variables — Path variable. It was in the user section, but wasn’t in the system section. I added it, restarted but still no result.
- Changing account name in Windows. My account name was ‘username’ and that’s how my User folder is called `C:\Users\username’, but I later connected it to Microsoft account and my user name is now User Name with a space and I can’t really change it. My folder stayed the same. Not sure if I can fix it that way.
To the two last things I tried I should also add that I changed my Windows username from ‘username’ to ‘user name’ with a space, but that wasn’t until recently.
I’m attaching the idea.log file for you to check. I replaced my real username with ‘User Name’ to highlight the existence of a space.
Solution
OK, that was a lucky one! I’m thus posting my comment as an answer:
The problem is caused by the non-ASCII characters in the path, and the solution is to remove them. As indicated by @TheLazyScripter this is a known issue.
Invalid Python SDK Error while using Python 3.4 on PyCharm
When I switch my PyCharm to use Python 3.4.3 and I am getting the error:
Also PyCharm does not automatically find the Python 3.4 interpreter for me, even though it is on the desired path /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 . See the screenshot:

Despite this the interpreter does work. I am able to get correct output as expected, but code completion related to Python 3.4 is not working.