Score:1

ModuleNotFoundError: No module named 'distutils.cmd'

pf flag

I update Ubuntu 20.4 to 22.4 and after that pip is no longer working in the virtual environments based on python 3.9 and this is the error I get:

ModuleNotFoundError: No module named 'distutils.cmd'

What I understood from my searches is that the missing module was in Python3.8 and they suggested to install the module

sudo apt install python3.8-distutils

I did it and got this error:

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

Package python3.8-distutils is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from Another source

E: Package 'python3.8-distutils' has no installation candidate

I have no idea what to do.

Score:2
ax flag

I got the same error when setting up a project that is expecting Python 3.8 on Ubuntu 22.04. Since I had installed Python 3.8 using the deadsnakes PPA already, simply issuing

sudo apt install python3.8-distutils

solved the problem for me.

Austine Iyke avatar
cn flag
Also for python 3.9 `sudo apt install python3.9-distutils`
Score:1
pf flag

Eventually I decided to try to turn around the problem. I created a backup of my virtual environment then I updated it to python3.10 because with this version pip worked properly.

python3.10 -m venv --upgrade my-env

this solution apparently works well.

kanehekili avatar
zw flag
Never ever install another python version. Python is an integral part of Ubuntu See [here](https://askubuntu.com/a/1443137/906933) for more infos. Using pipenv or others environments is fine
Angelo Mascaro avatar
pf flag
You are right and I didn't. As I wrote: "I update Ubuntu 20.04 to 22.04" I always uses venv and I do every change in the virtual environment that requires changes. What solved the problem was updating the virtual environment.
kanehekili avatar
zw flag
Ah, nice catch. Thanks for sharing.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.