Ошибка 'Invalid Python SDK' сразу после создания нового проекта в PyCharm
Некоторое время назад я серьезно разбил свой компьютер с Windows при использовании PyCharm — я помню некоторые ошибки с памятью, а затем жесткий сбой без синего экрана — просто черный с некоторыми тонкими вертикальными линиями и перезагрузка на экран установки / исправления Windows. С тех пор у меня была эта проблема, и я не нашел в Интернете возможности исправить это.
Редактировать: Судя по всему, это не имеет ничего общего с проблемой.
Проблема
Всякий раз, когда я открываю проект или создаю новый, появляется сообщение об ошибке Invalid Python SDK.
Кроме того, так выглядит рабочая среда, когда я закрываю это сообщение. В окне проекта каталог venv (и все каталоги в нем) помечен как исключение, а в коде функция print(f’Hi,
Более того, когда я перехожу к настройкам Python Interpreter в File -> Settings -> Project -> Python Interpreter , внизу появляется желтая полоса, которая говорит:
Который через некоторое время говорит:
Инструменты упаковки Python не найдены.
После установки ничего не меняется, и я не могу добавлять пакеты с этого экрана (кнопка «+» неактивна):

Когда я пытаюсь проверить пути интерпретатора Python, они не отображаются, и я не знаю, что это значит:

Короче говоря , все функции Python по умолчанию, такие как print, помечаются как ошибки, даже если они работают при выполнении. Это делает кодирование чрезвычайно запутанным, поскольку я не могу быстро отличить настоящие ошибки от «ошибок».
Поиск решения
Обычно это проблема с настройкой интерпретатора или путем, но я пробовал большинство методов, предложенных в других ответах на аналогичные вопросы. Назвать несколько :
- PyCharm показывает ошибку неразрешенных ссылок для допустимого кода
- «Невозможно настроить Python SDK» в проекте PyCharm с использованием virtualenv после переустановки ОС
- Почему я получаю сообщение об ошибке «SDK кажется недействительным» при настройке моего Project Interpreter в PyCharm?
- Ошибка недопустимого Python SDK при использовании python 3.4 в PyCharm
- Недействительный Python SDK при установке venv
Должны были быть ссылки, но у меня недостаточно репутации в Stack Overflow, чтобы опубликовать их с вопросами. Однако их можно легко найти в Google, все они размещены в Stack Overflow.
Что я пробовал
Я должен упомянуть, что первым делом я попытался удалить и установить PyCharm, все пользовательские конфигурации, а также сам Python. Я установил Python с официального сайта, а из приложения PyCharm оба метода закончились одинаковым результатом.
- File -> Invalidate Caches. -> Invalidate and restart. Не сработало.
- Проверка интерпретатора файлов в Edit Configurations . Не знаю, что с этим делать. Результат:

- Обновление путей интерпретатора. Даже сейчас пути не дают результатов.

- Удаление интерпретатора и его повторное добавление. Безрезультатно.
- Удаление папки .idea . Безрезультатно.
- Удаление пользовательских настроек PyCharm в %homepath%/.PyCharm50 . Но у меня нет этой папки.
- Переключение переводчика туда и обратно. Безрезультатно.
- Создание нового интерпретатора в другом месте. Безрезультатно.
- Пометка каталога проекта как корневого ProjectName -> Mark Directory as -> Sources Root и снятие отметки с других каталогов как исключенных. Безрезультатно.
- Без переводчика. Да, он больше не отмечает ошибки как ошибки. Но код не работает. Для меня это не решение.
- Проверка правильности установки путей для venv/pyvenv.cfg . Мне они нравятся.

- Проверка переменных среды Windows — переменная пути. Он был в пользовательском разделе, но не в системном. Я добавил его, перезапустил, но все еще безрезультатно.
- Изменение имени учетной записи в Windows. Имя моей учетной записи было ‘username’, и поэтому моя папка User называется `C: \ Users \ username ‘, но позже я подключил ее к учетной записи Microsoft, и мое имя пользователя теперь User Name с пробелом, и я действительно не могу изменить Это. Моя папка осталась прежней. Не уверен, что смогу исправить это таким образом.
К двум последним вещам, которые я пробовал, я должен также добавить, что я изменил свое имя пользователя Windows с «имя пользователя» на «имя пользователя» с пробелом, но это было не так до недавнего времени.
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 pycharm что делать



- PyCharm показывает ошибку неразрешенных ссылок для допустимого кода
- «Невозможно настроить Python SDK» в проекте PyCharm с использованием virtualenv после переустановки ОС
- Почему я получаю сообщение об ошибке «SDK кажется недействительным» при настройке моего Project Interpreter в PyCharm?
- Ошибка недопустимого Python SDK при использовании python 3.4 в PyCharm
- Недопустимый Python SDK при установке venv Должны были быть ссылки, но у меня недостаточно репутации в Stack Overflow, чтобы публиковать их с вопросами. Однако их можно легко найти в Google, все они размещены в Stack Overflow.
- File -> Invalidate Caches. -> Invalidate and restart. Не сработало.
- Проверка интерпретатора файлов в Edit Configurations . Не знаю, что с этим делать. Результат:

- Обновление путей интерпретатора. Даже сейчас пути не дают результатов.

- Удаление интерпретатора и его повторное добавление. Безрезультатно.
- Удаление папки .idea . Безрезультатно.
- Удаление пользовательских настроек PyCharm в %homepath%/.PyCharm50 . Но у меня нет этой папки.
- Переключение переводчика туда и обратно. Безрезультатно.
- Создание нового интерпретатора в другом месте. Безрезультатно.
- Пометка каталога проекта как корневого ProjectName -> Mark Directory as -> Sources Root и снятие отметки с других каталогов как исключенных. Безрезультатно.
- Без переводчика. Да, он больше не отмечает ошибки как ошибки. Но код не работает. Для меня это не решение.
- Проверка правильности установки путей для venv/pyvenv.cfg . Мне они нравятся.

- Проверка переменных среды Windows — переменная пути. Он был в пользовательском разделе, но не в системном. Я добавил его, перезапустил, но все еще безрезультатно.
- Изменение имени учетной записи в Windows. Имя моей учетной записи было ‘username’, и поэтому моя папка User называется `C: \ Users \ username ‘, но позже я подключил ее к учетной записи Microsoft, и мое имя пользователя теперь User Name с пробелом, и я действительно не могу изменить Это. Моя папка осталась прежней. Не уверен, что смогу исправить это таким образом.
Why do I get an ‘SDK seems invalid’ error when setting up my Project Interpreter in PyCharm?

I try to set up project interpteter Python 3.5 in Pycharm and get an SDK error?
Any solution to fix it?
![]()
11 Answers 11
did you move the whole project after you open it with pycharm? if so, just remove the .idea/* (run rm -r .idea under you project)
This problem is caused by: pycharm will create a .idea file under the project after the first time you import the project. SO the path in there will remain the old one after you moved the project. Thus the pycharm will keep trying to import ‘old_path/venv/bin/activate’ which is kept in .idea/*
I had such problem. The solution was pretty easy. I created an account in russian in Windows, and you could emphasize that the error message (the big one) then contains the word about encoding is used. Therefore check your Windows account name — change it if it’s not in english and contains spaces and other unwanted signs. Thanks.
![]()
I just had this error and got around it, and long-story-short I think it may have had to do with my PATH / PY_HOME / PYTHONPATH environment variables pointing to a different version of Python. Here’s what I did:
Background:
- In my case, I was trying to get a Python 2.7 venv running on a laptop where I’d previously been working with Python 3.
- I’m using Windows 7.
Solution:
- Hit the Windows key to pop up the Start menu.
- Type out ‘path’ and hit Enter.
- The ‘Environment Variables’ window should appear.
- There should be two sections of the window:
- One should say, «User variables for your_user_name».
- The other should say «System variables».
- I removed any references to Python 3.
- I set the PY_HOME variable to C:\Python27 (or whatever the path is to the Python installation you’re trying to get working in PyCharm.)

I got the same problem on windows 10, and got the solution.
Root cause: — Python cannot be launched due to no python27.dll.
Solution: — Install python or put python27.dll in PATH

A fix for this issue, is tell to the global var named-> LD_LIBRARY_PATH to include the new python libraries compiled. Let’s assume that you have just download python, extracted it & installed; assume that you have downloaded the 3.6.4 version
For include the library, you have to edit your .bashrc file. (This file is quite interesting, have a look 😉 ). This file is an «hidden file» placed in your home: nano
/.bashrc is a quite easy text editor. Go at the end of the file and append this command, replacing your path of new python export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ whoami /Downloads/Python-3.6.4
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,
‘) function is marked as an unresolved reference error shown below. The program, however, executes flawlessly. 
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.
- There should be two sections of the window: