Failed to create interpreter

Hi All, 

On an Ubuntu 20 LTS system (Ubuntu 20.04.1 LTS), just upgraded from 18.04 LTS
and running Pycharm 2020.2.3 professional (re-installed several times since upgrade of Ubuntu, via snap).

Checking that I have distutils installed:
sudo apt-get reinstall python3-distutils

Gives the following output:

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 1 to reinstall, 0 to remove and 11 not to upgrade.
Need to get 0 B/141 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 397429 files and directories currently installed.)
Preparing to unpack .../python3-distutils_3.8.5-1~20.04.1_all.deb ...
Unpacking python3-distutils (3.8.5-1~20.04.1) over (3.8.5-1~20.04.1) ...
Setting up python3-distutils (3.8.5-1~20.04.1) ...

 

At the bash command line:
pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

 

Within pycharm, creating a new project
executes the following command:
/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip install --no-index /snap/pycharm-professional/218/plugins/python/helpers/setuptools-44.1.1-py2.py3-none-any.whl

This fails, indicating that the it "Failed to create interpreter"
giving the following output...
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/__main__.py", line 23, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/main.py", line 10, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 9, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/main_parser.py", line 7, in <module>
File "/snap/pycharm-professional/218/plugins/python/helpers/pip-20.1.1-py2.py3-none-any.whl/pip/_internal/cli/cmdoptions.py", line 19, in <module>
ModuleNotFoundError: No module named 'distutils.util'


How can I get Pycharm to start using the installed version of distutils or it's own version so I can get back to developing with this IDE?
Or doesn't Pycharm function with Ubuntu 20 LTS?

3 comments
Comment actions Permalink

Hello,

To check if this is IDE related issue, please try creating a venv with the same base interpreter out of PyCharm. I am wondering if you will get the same error.

As a possible step here, you can uninstall the existing python version and install python which has distutils included. https://www.python.org/downloads/

0
Comment actions Permalink

Hello,

I had the same problem and was also not able to create the environment outside of PyCharm (thanks for the hint!).

I managed to resolve with the following line.

sudo apt install python3.8-venv

This was all I was missing :)

6
Comment actions Permalink

Follow the last solution( https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009821020/comments/4407595124242), the following code didn't work with me:

sudo apt install python3.8-venv

I tried:

sudo apt install python3-venv

and it worked but I don't know exactly why is it, maybe that's not my python version.

0

Please sign in to leave a comment.