Closed clayote closed 2 years ago
from the PPA page
python#.#-distutils
: provides the standard librarydistutils
module
you need to install that (it may be python3-distutils
depending on your OS)
in the future please search the issue tracker and the docs! there's a bunch of duplicates and a quick ^F
distutils would have saved you the trouble
There is no python3.9-distutils! It's a virtual package pointing to python3-distutils
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ sudo apt install python3.9-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python3-distutils' instead of 'python3.9-distutils'
python3-distutils is already the newest version (3.8.10-0ubuntu1~20.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pip still isn't working after I do that, if that's not obvious??
There is no python3.9-distutils! It's a virtual package pointing to python3-distutils
take a second to read please: (it may be python3-distutils
depending on your OS)
I can only assume you've done something very wrong (like sudo rm -rf /usr/lib/python3.9
to end up in this state since the python3-distutils
package provides distutils/util.py
for python3.9:
$ dpkg -L python3-distutils | grep distutils/util
/usr/lib/python3.8/distutils/util.py
/usr/lib/python3.9/distutils/util.py
$ dpkg -L python3-distutils | grep distutils/util | xargs ls -al
-rw-r--r-- 1 root root 20892 May 11 2021 /usr/lib/python3.8/distutils/util.py
-rw-r--r-- 1 root root 20913 May 11 2021 /usr/lib/python3.9/distutils/util.py
It's not there for me...
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ dpkg -L python3-distutils | grep distutils/util
/usr/lib/python3.8/distutils/util.py
/usr/lib/python3.9/distutils/util.py
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ dpkg -L python3-distutils | grep distutils/util | xargs ls -al
ls: cannot access '/usr/lib/python3.9/distutils/util.py': No such file or directory
-rw-r--r-- 1 root root 20892 May 11 2021 /usr/lib/python3.8/distutils/util.py
I did an uninstall/reinstall just in case
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ ls /usr/lib/python3.9/distutils
__init__.py __pycache__ version.py
I guess there's supposed to be some symlinks here?
if dpkg -L
says the file should be there and it's not there then that's on you
Purged things to be safe... there was some python3.9-minimal
and libpython3
configuration files hanging around that I thought might have been causing problems
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ ls /usr/lib/python3.9
ls: cannot access '/usr/lib/python3.9': No such file or directory
Installed fresh...
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ sudo apt install python3.9 python3.9-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python3-distutils' instead of 'python3.9-distutils'
python3-distutils is already the newest version (3.8.10-0ubuntu1~20.04).
The following additional packages will be installed:
libpython3.9-minimal libpython3.9-stdlib python3.9-minimal
Suggested packages:
python3.9-venv
The following NEW packages will be installed:
libpython3.9-minimal libpython3.9-stdlib python3.9 python3.9-minimal
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,885 kB of archives.
After this operation, 19.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.9-minimal amd64 3.9.10-1+focal1 [789 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.9-minimal amd64 3.9.10-1+focal1 [1,918 kB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.9-stdlib amd64 3.9.10-1+focal1 [1,694 kB]
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.9 amd64 3.9.10-1+focal1 [484 kB]
Fetched 4,885 kB in 3s (1,679 kB/s)
Selecting previously unselected package libpython3.9-minimal:amd64.
(Reading database ... 488193 files and directories currently installed.)
Preparing to unpack .../libpython3.9-minimal_3.9.10-1+focal1_amd64.deb ...
Unpacking libpython3.9-minimal:amd64 (3.9.10-1+focal1) ...
Selecting previously unselected package python3.9-minimal.
Preparing to unpack .../python3.9-minimal_3.9.10-1+focal1_amd64.deb ...
Unpacking python3.9-minimal (3.9.10-1+focal1) ...
Selecting previously unselected package libpython3.9-stdlib:amd64.
Preparing to unpack .../libpython3.9-stdlib_3.9.10-1+focal1_amd64.deb ...
Unpacking libpython3.9-stdlib:amd64 (3.9.10-1+focal1) ...
Selecting previously unselected package python3.9.
Preparing to unpack .../python3.9_3.9.10-1+focal1_amd64.deb ...
Unpacking python3.9 (3.9.10-1+focal1) ...
Setting up libpython3.9-minimal:amd64 (3.9.10-1+focal1) ...
Setting up python3.9-minimal (3.9.10-1+focal1) ...
Setting up libpython3.9-stdlib:amd64 (3.9.10-1+focal1) ...
Setting up python3.9 (3.9.10-1+focal1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24+linuxmint1) ...
But no luck.
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ python3.9 -m pip install --user numpy
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
sanotehu@sanotehu-MS-7A31:~/src/LiSE$ ls /usr/lib/python3.9/distutils
__init__.py __pycache__ version.py
python3-distutils is already the newest version (3.8.10-0ubuntu1~20.04).
I can't help you, you've done some dumb things to your system with sudo
that I can't see (because you haven't shown me). stop running sudo rm
on things managed by the package manager. your python3-distutils
package is missing files that you've deleted with sudo
for some unknown reason
For anyone else who finds this, the magic command was sudo apt reinstall python3-distutils
presumably noone will have run sudo rm -rf /usr/lib/python3.9
to get themselves into your mess in the first place
description
python3.9 can't import the system-wide distutils, and therefore, cannot use pip.
os information
lsb_release -a
uname -a