Skip to content

pip install -e crashes on Python 3.8 when 'typing' is installed from PyPI because it runs a sub-command in such a way that site-packages comes before lib/python3.8 #8272

Closed
@glyph

Description

@glyph

Environment

  • pip version: 20.1, 20.1.1
  • Python version: 3.8.2
  • OS: macOS, linux

Description
pip install -e fails with a traceback if the typing module is installed from PyPI.

Expected behavior
It should work, like it used to.

How to Reproduce

python3.8 -m venv foo
./foo/bin/pip install typing
./foo/bin/pip install -e ~/src/twisted

Output

  ERROR: Command errored out with exit status 1:
   command: /Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/bin/python /Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/z9/w23lcw3x70z1fqpcwjjbvkvc0000gp/T/pip-build-env-f7o2d80a/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i http://127.0.0.1:3141/root/plus/+simple/ -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (44 lines):
  Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
      exec(code, run_globals)
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/__main__.py", line 26, in <module>
      sys.exit(_main())
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
      command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
      module = importlib.import_module(module_path)
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
    File "<frozen importlib._bootstrap>", line 991, in _find_and_load
    File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 783, in exec_module
    File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 24, in <module>
      from pip._internal.cli.req_command import RequirementCommand, with_cleanup
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 16, in <module>
      from pip._internal.index.package_finder import PackageFinder
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/index/package_finder.py", line 21, in <module>
      from pip._internal.index.collector import parse_links
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 14, in <module>
      from pip._vendor import html5lib, requests
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 114, in <module>
      from . import utils
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_vendor/requests/utils.py", line 25, in <module>
      from . import certs
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_vendor/requests/certs.py", line 15, in <module>
      from pip._vendor.certifi import where
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_vendor/certifi/__init__.py", line 1, in <module>
      from .core import contents, where
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip/_vendor/certifi/core.py", line 12, in <module>
      from importlib.resources import read_text
    File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/resources.py", line 11, in <module>
      from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/typing.py", line 1357, in <module>
      class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
    File "/Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/typing.py", line 1005, in __new__
      self._abc_registry = extra._abc_registry
  AttributeError: type object 'Callable' has no attribute '_abc_registry'
  ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/bin/python /Users/glyph/.virtualenvs/tmp-7b0fea29ffcfc56/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/z9/w23lcw3x70z1fqpcwjjbvkvc0000gp/T/pip-build-env-f7o2d80a/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i http://127.0.0.1:3141/root/plus/+simple/ -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions