ModuleNotFoundError: No module named 'distutils.util'

Asked by berk

ModuleNotFoundError: No module named 'distutils.util'

pip --version
pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)

sudo apt-get install python3-distutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-distutils is already the newest version (3.11.2-2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

sudo apt-get install python3-apt
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-apt is already the newest version (2.5.3ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

sudo apt-get install --reinstall python3-distutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
Need to get 0 B/130 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 255786 files and directories currently installed.)
Preparing to unpack .../python3-distutils_3.11.2-2_all.deb ...
Unpacking python3-distutils (3.11.2-2) over (3.11.2-2) ...
Setting up python3-distutils (3.11.2-2) ...

sudo apt-get install --reinstall python3-apt
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
Need to get 0 B/163 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 255786 files and directories currently installed.)
Preparing to unpack .../python3-apt_2.5.3ubuntu1_amd64.deb ...
Unpacking python3-apt (2.5.3ubuntu1) over (2.5.3ubuntu1) ...
Setting up python3-apt (2.5.3ubuntu1) ...

and i still get the same error: no module named 'distutils.util'

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
Last query:
Last reply:
Revision history for this message
Bernard Stafford (bernard010) said (last edit ):
#1

Terminal : apt policy python3-distutils
Please paste output here.

Revision history for this message
berk (jupicool) said :
#2

python3-distutils:
  Installed: 3.11.2-2
  Candidate: 3.11.2-2
  Version table:
 *** 3.11.2-2 500
        500 http://archive.ubuntu.com/ubuntu lunar/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu lunar/main i386 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Bernard Stafford (bernard010) said :
#3

You have python3-distutils correctly installed.

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

When and where do you receive the message " no module named 'distutils.util'"?

Revision history for this message
berk (jupicool) said (last edit ):
#5

i run invoke.sh in order to launch invoke ai

Revision history for this message
Best Manfred Hampl (m-hampl) said :
#6

1. distutils is deprecated, see https://peps.python.org/pep-0632/

2. invokeai is a foreign package from outside Ubuntu.

3. I do not know where you got invokeai from, but according to https://invoke-ai.github.io/InvokeAI/installation/010_INSTALL_AUTOMATED/#walk-through

"We do not recommend using Python 3.11 or higher, as not all the libraries that InvokeAI depends on work properly with this version."

You probably better as ask at the source where you got invokeai, maybe https://github.com/invoke-ai/InvokeAI/issues

Revision history for this message
berk (jupicool) said :
#7

hm, i thought that it could be all about the python version actually. invoke has only 3.10 libs in its folder. thank you!

Revision history for this message
berk (jupicool) said :
#8

Thanks Manfred Hampl, that solved my question.