On Debian-based distros such as Ubuntu, the distutils package is mostly missing. Only the package root and distutils.version is available. The remaining code has been moved to python3-distutils, which must be installed separately.
The following command should solve the problem in Ubuntu 18.04, 20.04 and 22.04:
sudo apt-get install python3-distutils If you're using a specific python3 minor version, different from the distro python3 default, then you may need to install the corresponding minor version of the system distutils package. E.g. for Python 3.10:
sudo apt-get install python3.10-distutils reference: Negative Python user experience on Debian/Ubuntu - distutils is stripped down and missing most code.