Python AttributeError: type object 'Callable' has no attribute '_abc_registry'

Looking how to solve Python or Jupyter Notebook error: AttributeError: type object 'Callable' has no attribute '_abc_registry'? I've met the error several times:

  • during tox tests
  • installation or upgrade of python module
  • in Jupyter Notebook

Full error:

    File "/home/vanx/PycharmProjects/matt/venv38/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/vanx/Software/Other/Python-3.8.4/Lib/importlib/resources.py", line 11, in <module>
      from typing import Iterable, Iterator, Optional, Set, Union   # noqa: F401
    File "/home/vanx/PycharmProjects/matt/venv38/lib/python3.8/site-packages/typing.py", line 1359, in <module>
      class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
    File "/home/vanx/PycharmProjects/matt/venv38/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'

Solution 1: Uninstall module typing

The error is caused by module typing and can be resolve by removing this module:

pip uninstall typing

It seems that module typing is not working in Python 3.7 and 3.8.

Solution 2: Change requirements

Requirements for typing can be changed to:

'typing; python_version < '3.5'

Solution 3: Downgrade Python version

Older Python versions like 3.5, 3.6 should work fine with typing.

Resources