Why do I get an 'SDK seems invalid' error when setting up my Project Interpreter in PyCharm?

93,228

Solution 1

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/*

Solution 2

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.

Solution 3

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:

  1. Hit the Windows key to pop up the Start menu.
  2. Type out 'path' and hit Enter.
  3. The 'Environment Variables' window should appear.
    • There should be two sections of the window:
      1. One should say, "User variables for your_user_name".
      2. The other should say "System variables".
  4. In both sections of the window, look for and edit (if they exist) the PATH, PYTHONPATH, and PY_HOME environment variables.
    1. I removed any references to Python 3.
    2. 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.)
  5. I also deleted my installation of Python27 and reinstalled it, but I'm not sure that that was necessary.
  6. Restart PyCharm.

Solution 4

I got the same problem on windows 10, and got the solution.

PyCharm_Python_error.png

Root cause: - Python cannot be launched due to no python27.dll.

Solution: - Install python or put python27.dll in PATH

Thanks.

Share:
93,228
NibiruSpetsnaz
Author by

NibiruSpetsnaz

Updated on July 09, 2022

Comments

  • NibiruSpetsnaz
    NibiruSpetsnaz almost 2 years

    enter image description here

    I try to set up project interpteter Python 3.5 in Pycharm and get an SDK error?

    Any solution to fix it?

  • Csaba Toth
    Csaba Toth over 5 years
    I reinstalled Python, recreated vritualenvs and this was the key to my problems seemingly. At least to some of them.