Can't install virtual interpreter in PyCharm in Linux

95,585

Solution 1

I had to install it. This was fresh Kubuntu 18.04 install, obviously, without this needed package.

sudo apt-get install python3-distutils

After that I restarted PyCharm and creating virtual project interpreter was successful.

Solution 2

If @Hrvoje T's answer did not work (it did not work for me) then try this:

Run this command and you should be able to install the packaging tools in Pycharm:

sudo apt install python3-pip

It's python3-pip, not python-pip if you are using the Python3 interpreter.

https://stackoverflow.com/questions/43567996/pycharm-python-packaging-tools-not-found

Solution 3

Neither @Hrvoje T and @hyukkyulee worked for me since I had already installed those packages. Uninstalling and reinstalling didn't solve the issue as well.

I just upgraded my system to Ubuntu 19.10 and I noticed that they had upgrade the python interpreter to 3.7. PyCharm however was generating the venv interpreter based to its previous one (python 3.6). By changing the base interpreter from New Interpreter block I solved this issue.

Share:
95,585

Related videos on Youtube

Hrvoje T
Author by

Hrvoje T

Trying to learn Python/PySide :)

Updated on September 18, 2022

Comments

  • Hrvoje T
    Hrvoje T over 1 year

    When I try to add virtualenv as an interpreter in PyCharm Community 2018.1.2 in Kubuntu 18.04 I get the following error:

    ModuleNotFoundError: No module named 'distutils.core'

    enter image description here

    How can I solve this?

    • phoenix
      phoenix over 5 years
      Tracking issue for this to be fixed: youtrack.jetbrains.com/issue/PY-32099
    • DimiDak
      DimiDak about 5 years
      Always in linux... No problem on mac/windows, only in linux you always gotta add/fix something to work and get embarrassed when supporting it over the other two...
    • Hrvoje T
      Hrvoje T about 5 years
      Every platform has its own problems.
  • Hrvoje T
    Hrvoje T over 5 years
    I used Kubuntu, not Ubuntu.
  • MadMike
    MadMike over 5 years
    @HrvojeT This will work on any ([KULX]buntu on any plublished version.
  • MadMike
    MadMike over 5 years
    To bad the question doesn't specify how pycharm has been installed. So just for the completness sake: 1. This Pycharm has probably been installed with snap. (I use pycharm on several installs on a daily basis and never had this error. Only after testing snap with pycharm on a new 18.04 install) 2. After installing 'python3-disutils'. I received the error "ModuleNotFoundError: No module named 'setuptools'".
  • wowkin2
    wowkin2 almost 5 years
    This will not install setup-tools. But python3-pip does.
  • Basic
    Basic almost 5 years
    @MadMike In my case, the issue was a windows install attempting to use the remote SSH interpreter while targeting a raspbian server. Simply installing distutils as shown above was sufficient to get the interpreter going.
  • mLstudent33
    mLstudent33 over 4 years
    I cannot install python3-pip, please see askubuntu.com/questions/1185084/…
  • Gunslinger
    Gunslinger over 4 years
    PyCharm from snap: It got me past that error. Then I got to install setuptools.
  • Sarthak Kumar
    Sarthak Kumar about 4 years
    after running this command I get python3-distutils is already the newest version (3.8.2-1ubuntu1). but getting the same error, can someone help me.