Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI fails with "AttributeError: type object 'Callable' has no attribute '_abc_registry'" #7616

Closed
bluetech opened this issue Aug 4, 2020 · 3 comments

Comments

@bluetech
Copy link
Member

bluetech commented Aug 4, 2020

Something broke on CI:

    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_internal\commands\install.py", line 17, in <module>
      from pip._internal.cli.req_command import RequirementCommand, with_cleanup
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_internal\cli\req_command.py", line 16, in <module>
      from pip._internal.index.collector import LinkCollector
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_internal\index\collector.py", line 14, in <module>
      from pip._vendor import html5lib, requests
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_vendor\requests\__init__.py", line 125, in <module>
      from . import utils
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_vendor\requests\utils.py", line 25, in <module>
      from . import certs
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_vendor\requests\certs.py", line 15, in <module>
      from pip._vendor.certifi import where
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_vendor\certifi\__init__.py", line 1, in <module>
      from .core import contents, where
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\pip\_vendor\certifi\core.py", line 12, in <module>
      from importlib.resources import path as get_path, read_text
    File "c:\hostedtoolcache\windows\python\3.8.5\x64\lib\importlib\resources.py", line 11, in <module>
      from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\typing.py", line 1359, in <module>
      class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
    File "D:\a\pytest\pytest\.tox\py38-unittestextras\lib\site-packages\typing.py", line 1007, in __new__
      self._abc_registry = extra._abc_registry
  AttributeError: type object 'Callable' has no attribute '_abc_registry'

See pypa/pip#8272

Originally posted by @The-Compiler in #7614 (comment)

@bluetech
Copy link
Member Author

bluetech commented Aug 4, 2020

I think what happens is:

  1. The windows-py38 CI job installs twisted
  2. twisted depends on hyperlink
  3. hyperlink just released a version with type annotation support: https://github.com/python-hyper/hyperlink/blob/master/CHANGELOG.md#2000
  4. hyperlink depends on the typing backport package with typing ; python_version<"3.5"
  5. pip has the mentioned bug 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 pypa/pip#8272 which causes it to break where the typing package gets used instead of the stdlib typing.

As far as I understand, from the way hyperlink added the typing dependency it should not get installed on Python >= 3.5, but I just tested it and it does indeed get installed, not sure why.

$ virtualenv venv
created virtual environment CPython3.8.5.final.0-64 in 112ms
  creator CPython3Posix(dest=venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
$ source venv/bin/activate
(venv) $ pip install hyperlink
Collecting hyperlink
  Using cached hyperlink-20.0.0-py2.py3-none-any.whl (48 kB)
Collecting idna>=2.5
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Processing /home/ran/.cache/pip/wheels/5e/5d/01/3083e091b57809dad979ea543def62d9d878950e3e74f0c930/typing-3.7.4.3-py3-none-any.whl
Installing collected packages: idna, typing, hyperlink
Successfully installed hyperlink-20.0.0 idna-2.10 typing-3.7.4.3

@bluetech
Copy link
Member Author

bluetech commented Aug 5, 2020

This has been fixed in hyperlink.

@bluetech bluetech closed this as completed Aug 5, 2020
@The-Compiler
Copy link
Member

For the curious, here's the hyperlink issue: python-hyper/hyperlink#133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants