Skip to content

upgrade from 22.2 to 22.2.1. fails with ImportError for name '_distutils' #11319

Closed
@mrclmh

Description

Description

When trying to upgrade from 22.2 to 22.2.1, the install fails because of an ImportError.
The setuptools version is 63.2.0.

Traceback (most recent call last):
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/commands/install.py", line 461, in run
    installed = install_given_reqs(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/req/__init__.py", line 73, in install_given_reqs
    requirement.install(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/req/req_install.py", line 752, in install
    scheme = get_scheme(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/locations/__init__.py", line 244, in get_scheme
    from . import _distutils
ImportError: cannot import name '_distutils' from 'pip._internal.locations' (/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/locations/__init__.py)

Expected behavior

Pip should be upgraded from 22.2 to 22.2.1

pip version

22.2

Python version

3.9.13

OS

macOS 10.15.7

How to Reproduce

With version 22.2 user-installed:

python3 -m pip install --user --upgrade pip

Output

% python3 -m pip install --user --upgrade pip    
Requirement already satisfied: pip in ./Library/Python/3.9/lib/python/site-packages (22.2)
Collecting pip
  Using cached pip-22.2.1-py3-none-any.whl (2.0 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 22.2
    Uninstalling pip-22.2:
      Successfully uninstalled pip-22.2
  Rolling back uninstall of pip
  Moving to /Users/mm/Library/Python/3.9/bin/pip
   from /private/var/folders/v_/3yqdc_t15jjb82bnmh1366ym0000gn/T/pip-uninstall-7x3mha7f/pip
  Moving to /Users/mm/Library/Python/3.9/bin/pip3
   from /private/var/folders/v_/3yqdc_t15jjb82bnmh1366ym0000gn/T/pip-uninstall-7x3mha7f/pip3
  Moving to /Users/mm/Library/Python/3.9/bin/pip3.9
   from /private/var/folders/v_/3yqdc_t15jjb82bnmh1366ym0000gn/T/pip-uninstall-7x3mha7f/pip3.9
  Moving to /Users/mm/Library/Python/3.9/lib/python/site-packages/pip-22.2.dist-info/
   from /Users/mm/Library/Python/3.9/lib/python/site-packages/~ip-22.2.dist-info
  Moving to /Users/mm/Library/Python/3.9/lib/python/site-packages/pip/
   from /Users/mm/Library/Python/3.9/lib/python/site-packages/~ip
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/commands/install.py", line 461, in run
    installed = install_given_reqs(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/req/__init__.py", line 73, in install_given_reqs
    requirement.install(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/req/req_install.py", line 752, in install
    scheme = get_scheme(
  File "/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/locations/__init__.py", line 244, in get_scheme
    from . import _distutils
ImportError: cannot import name '_distutils' from 'pip._internal.locations' (/Users/mm/Library/Python/3.9/lib/python/site-packages/pip/_internal/locations/__init__.py)

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    type: bugA confirmed bug or unintended behavior

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions