0

I've upgraded Ubuntu version on my PC from Ubuntu 18.04 LTS to 20.04 LTS.

After that I restarted my machine and trying to use PyCharm, I notice I can't run Python code from the IDE or run the Python Console neither, receiving this error message:

ModuleNotFoundError: No module named 'distutils'

Any idea of what could go wrong with the LTS version upgrade?

Vzzarr
  • 103
  • 1
  • 1
  • 9
  • This is likely due to the use of an older Python version than 3.8, which is 20.04's default version. You can either change the interpreter in PyCharm to 3.8 (which is then also used by default for creating new venvs) or changing Ubuntu's default Python interpreter to 3.x (your version, e.g., 3.7). – Julian L. Jul 01 '20 at 07:47
  • thanks @JulianL., how would you change Python interpreter? It was really painful tom me last time and I had to wipe the disk and reinstall Ubuntu 18.04 XD in particular I was trying to follow this solution https://stackoverflow.com/a/50271625/4725074 regarding the aforementioned exception but it kept installing the library for Python 3.8 so when using 3.6 I was continuing to get ModuleNotFoundError: No module named 'distutils' – Vzzarr Jul 01 '20 at 09:37
  • See this: https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html – Julian L. Jul 03 '20 at 06:35
  • Try checking the answers at https://askubuntu.com/questions/1239829/modulenotfounderror-no-module-named-distutils-util – user2298922 Jul 13 '22 at 11:32
  • 1
    I've solved similar issue by checking the answers at https://askubuntu.com/questions/1239829/modulenotfounderror-no-module-named-distutils-util – user2298922 Jul 13 '22 at 11:34

1 Answers1

0

From my understanding, after running this command:

vzzarr@mario:~$ ll /usr/bin/python3
lrwxrwxrwx 1 root root 9 Mar 13 12:20 /usr/bin/python3 -> python3.8*

the defaulted Python version is now 3.8 and not anymore 3.6.

So for me in Settings -> Project -> Project Interpreter and then from the perspective when clicking on Show All... and adding a new one - you should see something like that:

enter image description here

So in my case was sufficient to change Base Interpreter from /usr/bin/python3.6 to /usr/bin/python3.8

Vzzarr
  • 103
  • 1
  • 1
  • 9