1

TLDR: There are two version of Python on my system. The older version can't access distutils.

I am running a fresh install of Ubuntu 22.04.
The distro comes with two versions of python already installed: Python 3.10 & Python 3.9 and no instances of pip.

I've installed pip by running:

sudo apt install python3-pip

That makes pip available for Python 3.10. I can confirm that by:

$ python3.10 -m pip --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

However, pip is not working for Python 3.9. See:

$ python3.9 -m pip --version
Traceback (most recent call last):
...
from distutils.cmd import Command as DistutilsCommand

ModuleNotFoundError: No module named 'distutils.cmd'


python3-distutils is installed (v 3.10 only):

$ apt list --installed | grep distutils
python3-distutils/jammy-updates,jammy-updates,now 3.10.6-1~22.04 all [installed]

I can't install python3-distutils version 3.9:

$ sudo apt install python3.9-distutils
E: Unable to locate package python3.9-distutils
E: Couldn't find any package by glob 'python3.9-distutils'

Question How to make distutils available for Python 3.9 so pip works with the version of Python.

Jake
  • 11

0 Answers0