deadsnakes / issues

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

Cannot launch pip with Python 3.12 #262

Closed rgaudy closed 1 year ago

rgaudy commented 1 year ago

description

Impossible to launch pip in the intended way under Ubuntu 22.04 LTS. First it was crashing because distutils could not be found. I solved it by installing python3.12-distutils. But now I get the following:

~$ python3.12 -m pip list -o
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
             ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/list.py", line 169, in run
    for d in get_environment(options.path).iter_installed_distributions(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/metadata/__init__.py", line 36, in get_environment
    from .pkg_resources import Environment
  File "/usr/lib/python3/dist-packages/pip/_internal/metadata/pkg_resources.py", line 9, in <module>
    from pip._vendor import pkg_resources
  File "/usr/lib/python3/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2164, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

os information

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

uname -a


Linux MSI 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux```
asottile commented 1 year ago

you're best to make a virtualenv and work with pip that way

rgaudy commented 1 year ago

What? This does not work:

~$ python3.12 -m venv test_virtualenv/
Error: Command '['/home/raphael/test_virtualenv/bin/python3.12', '-m', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
asottile commented 1 year ago

are you missing the python3.12-venv package?

rgaudy commented 1 year ago

You're right it was missing! Now it works, and I can run pip from the venv. Thank you! :)