Can't install virtual interpreter in PyCharm in Linux
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.
Related videos on Youtube
Comments
-
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'
How can I solve this?
-
phoenix over 5 yearsTracking issue for this to be fixed: youtrack.jetbrains.com/issue/PY-32099
-
DimiDak about 5 yearsAlways 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 about 5 yearsEvery platform has its own problems.
-
-
Hrvoje T over 5 yearsI used Kubuntu, not Ubuntu.
-
MadMike over 5 years@HrvojeT This will work on any ([KULX]buntu on any plublished version.
-
MadMike over 5 yearsTo 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 almost 5 yearsThis will not install setup-tools. But
python3-pip
does. -
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 over 4 yearsI cannot install
python3-pip
, please see askubuntu.com/questions/1185084/… -
Gunslinger over 4 yearsPyCharm from snap: It got me past that error. Then I got to install setuptools.
-
Sarthak Kumar about 4 yearsafter 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.