Python 3.7 and 3.8 builds are failing: AttributeError: type object 'Callable' has no attribute '_abc_registry'

Failing build

It started with failing Python 3.7 builds (Python 3.8 worked well for a while) and now both do fail.

Error:

Processing ./.tox/.tmp/package/1/graphene-elastic-0.6.5.zip
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/bin/python /home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-zb8gxwqs/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (42 lines):
  Traceback (most recent call last):
    File "/opt/python/3.8.1/lib/python3.8/runpy.py", line 193, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/opt/python/3.8.1/lib/python3.8/runpy.py", line 86, in _run_code
      exec(code, run_globals)
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/__main__.py", line 26, in <module>
      sys.exit(_main())
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/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 "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 105, in create_command
      module = importlib.import_module(module_path)
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/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 "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 17, in <module>
      from pip._internal.cli.req_command import RequirementCommand, with_cleanup
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 18, in <module>
      from pip._internal.index.collector import LinkCollector
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_internal/index/collector.py", line 14, in <module>
      from pip._vendor import html5lib, requests
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_vendor/requests/__init__.py", line 125, in <module>
      from . import utils
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_vendor/requests/utils.py", line 25, in <module>
      from . import certs
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_vendor/requests/certs.py", line 15, in <module>
      from pip._vendor.certifi import where
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_vendor/certifi/__init__.py", line 1, in <module>
      from .core import contents, where
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/pip/_vendor/certifi/core.py", line 12, in <module>
      from importlib.resources import path as get_path, read_text
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/importlib/resources.py", line 11, in <module>
      from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/typing.py", line 1359, in <module>
      class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
    File "/home/travis/build/barseghyanartur/graphene-elastic/.tox/py38-elastic7/lib/python3.8/site-packages/typing.py", line 1007, in __new__
      self._abc_registry = extra._abc_registry
  AttributeError: type object 'Callable' has no attribute '_abc_registry'

Uninstall/don’t use the 3rd-party typing package, it conflicts with the builtin module available since 3.5.

Also report this as a problem to the package’s maintainer. Its metadata should say that it only supports <3.5.


This part is wrong:

See that the execution is within pip, then pip._vendor, then inside stock modules – and then suddenly jumps into a 3rd-party module typing. As such , Pip’s execution is “tainted” by it – it doesn’t run the logic that it was packaged with and tested against.

@native-api: Thanks for response! It works fine with Python 3.6 though.

Happens to work doesn’t mean that this is a supported configuration. 3rd-party typing should never be installed for versions where there is the built-in one.

You were right. Somehow, it still works with Python 3.6, but not higher. I added it in the setup.py conditionally and removed from requirements. It works now. Thanks!

1 Like