deadsnakes / issues

Issues for https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
86 stars 6 forks source link

python3.9-full, module not found error with distutils.util on Ubuntu 20.04 #217

Closed gamesguru closed 2 years ago

gamesguru commented 2 years ago

description

Not able to run python3.9 -m pip

After running sudo apt install python3.9-full.

After this operation, 50.0 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.9-minimal
...

NOTE: I removed everything in /usr/lib/python3.9 and /etc/python3.9 prior to re-install.

$ python3.9 -m pip
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'

os information

lsb_release -a

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal

uname -a


Linux M515 5.13.0-41-generic #46~20.04.1-Ubuntu SMP Wed Apr 20 13:16:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux```
asottile commented 2 years ago

the dependency is there -- it must've been whatever you did: https://github.com/deadsnakes/python3.9/blob/ec8b7b6b6aa5b197eb20e9cea7e1283541ae088d/debian/control#L209

using sudo to delete system package managed files is a very bad idea, why did you do that?

you can probably fix with sudo apt install --reinstall python3-distutils -- but this has nothing to do with deadsnakes so I can't help you further with free support

gamesguru commented 2 years ago

that solved it, guess i should reinstall all python3-* packages?

i assumed since my system only ships with python 3.8, anything in /usr/lib/python3.9 was safe to delete

asottile commented 2 years ago

in general nothing in /usr (outside of /usr/local) is "safe to delete" -- those packages are managed by your system package manager

python3-distutils (provided by ubuntu) ships code for 3.8, and 3.9