python-3.xpycharmvirtualenvinterpreter

PyCharm cannot create Interpreter in Python3


I am a newbie in programming and have been learning only for a little while. I am trying to get started using PyCharm but it does not manage to create an interpreter in Python3. When I try to create it it generates this error:

Using base prefix '/Library/Frameworks/Python.framework/Versions/3.10'
New python executable in /Users/tom/PycharmProjects/untitled1/venv/bin/python3
Also creating executable in /Users/tom/PycharmProjects/untitled1/venv/bin/python
ERROR: The executable /Users/tom/PycharmProjects/untitled1/venv/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.10' (should be '/Users/tom/PycharmProjects/untitled1/venv')
ERROR: virtualenv is not compatible with this system or executable

I am using MacOS 10.14.6, PyCharm version 2019.3.5 Community Edition, Python 3.10.11. I have tried using Python 3.12 (but it gave me an error saying it did not find the module called 'distutils' so I downloaded 3.11. It then gave me this "virtualenv is not compatible with this system or executable" error.

I have used pip to install virtualenv (v20.25.1), which was the option suggested in the other posts here in StackOverflow but it did not change anything. It's maybe useful to say that I did have Anaconda in this computer before, but I tried to thoroughly uninstall it and the version of python it had (3.6 I believe).

Using python 2.7, which came natively in my Mac, generates no errors. Also, I seem to be able to create virtual environments from the Mac Terminal.

Any idea on how I can fix this? I had to basically stop all of my Python learning because of this error.


Solution

  • It took me a few hours but I just figured out the problem: PyCharm 2019 is compatible with MacOS 10.14 but not with Python 3.10.

    If there's anyone out there like me who doesn't want to upgrade from MacOS 10.14 because you still have some 32-bit programs running I was able to find a sweet spot with PyCharm 2021.3. You can check the requirements and compatibilities of each PyCharm version here: https://www.jetbrains.com/help/pycharm/quick-start-guide.html#meet