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?

  • Tracking issue for this to be fixed: youtrack.jetbrains.com/issue/PY-32099 – phoenix Jan 29 at 21:29
  • 1
    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... – DimiDak Feb 12 at 11:35
  • Every platform has its own problems. – Hrvoje T Feb 12 at 11:43

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.

  • 1
    This worked fine for me. – cstrutton Oct 7 '18 at 11:19
  • 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'". – MadMike Oct 16 '18 at 5:42
  • This will not install setup-tools. But python3-pip does. – wowkin2 Jul 10 at 7:49
  • @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. – Basic Jul 15 at 20:57

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.



Actually, @hyukkyulee solution solved the issue.

It is because, by default, Ubuntu comes with python 2.7 and python 3.x version. And if you have installed pip using

sudo apt install python-pip

will install 'pip' in python 2.7 folder.

so you need to specify python3-pip to install pip in python 3 folder along with other util packages.

  • I used Kubuntu, not Ubuntu. – Hrvoje T Oct 7 '18 at 7:34
  • @HrvojeT This will work on any ([KULX]buntu on any plublished version. – MadMike Oct 16 '18 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.