from typing import Any
File "/.tox/django22/lib/python3.8/site-packages/typing.py", line 1357, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/.tox/django22/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'
Hm, with Python 3.8, typing.py should not come from site-packages. This seems to point to some installation or configuration error on your part. Please seek help elsewhere.
I'm on python 3.7 and latest pip and recently started getting this error. My solution was to remove typings. Is there a better solution?
"__main__", mod_spec)
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/pip/__main__.py", line 26, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/__init__.py", line 104, in create_command
module = importlib.import_module(module_path)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 16, in <module>
from pip._internal.index.package_finder import PackageFinder
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "/usr/local/lib/python3.7/dist-packages/pip/_internal/index/collector.py", line 14, in <module>
from pip._vendor import html5lib, requests
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/requests/__init__.py", line 114, in <module>
from . import utils
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/requests/utils.py", line 25, in <module>
from . import certs
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/requests/certs.py", line 15, in <module>
from pip._vendor.certifi import where
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/certifi/__init__.py", line 1, in <module>
from .core import contents, where
File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/certifi/core.py", line 12, in <module>
from importlib.resources import read_text
File "/usr/lib/python3.7/importlib/resources.py", line 11, in <module>
from typing import Iterable, Iterator, Optional, Set, Union # noqa: F401
File "/usr/local/lib/python3.7/dist-packages/typing.py", line 1357, in <module>
class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
File "/usr/local/lib/python3.7/dist-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: /usr/bin/python3 /usr/local/lib/python3.7/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-08s0ryte/overlay --no-warn-script-location --no-binary greenlet,pinterest-pintrace,pintrace --only-binary :none: -i https://mysite.com/artifactory/api/pypi/pypi-python-pip-prod-remote/simple/ --extra-index-url https://pypirepo.pinadmin.com/ -- 'setuptools>=42' wheel 'setuptools_scm[toml]>=3.4' Check the logs for full command output.
The solution is probably pip uninstall typing.
This worked. Any idea why this might happen all of a sudden?
Maybe you or a script incorrectly ran 'pip install typing'. Or maybe some other thing that you installed had an incorrect dependency on typing. It would require a lot of research to find out what happened, and it would have to be done on your computer. I haven't heard of this before (other than the initial report in this issue).
I wonder if there's a way to make this package refuse to install itself on any Python version that has a typing module in the stdlib. (I think starting with 3.5.)
The python_requires for typing https://github.com/python/typing/blob/08a537d484edddb563288982f8073d241fec5535/setup.py#L70 allows it to be installed on 3.4+
It was changed in https://github.com/python/typing/pull/722, and it seems you proposed disallowing installation on 3.5+. Seeing as all versions of Python 3 that don't have typing in the stdlib are not longer supported themselves, I guess the pypi package only has use for 2.7?
Seeing as all versions of Python 3 that don't have typing in the stdlib are not longer supported themselves, I guess the pypi package only has use for 2.7?
2.7 is also unsupported now, though clearly it's still being used a lot. Some projects also decide to continue to support unsupported Python 3 versions. For a very widely used package such as typing I'd argue that it makes sense to continue supporting older Python releases after their end of life, at least unless it's very difficult.
Maybe the right thing to do is just not to do any new releases of the typing package itself, but focus our attention on typing_extensions (also in this repo)? If typing works now for Python releases that are no longer supported, it should just keep working, right? Or perhaps we could do one final release, which refuses to let itself be installed in 3.5 and up to prevent the original problem of this issue.
2.7 is also unsupported now
Is that true for typing tools in general? I believe typeshed for example should still accept Python 2.7 fixes.
Yeah, typeshed still supports 2.7. I meant that CPython 2.7 has reached it's End of Life.
(Tangentially related: even if typeshed doesn't support older 3.x releases officially, more recent 3.x stubs generally work just fine with older Python 3 releases.)
Would releasing a new version of typing fix (or avoid) https://github.com/pypa/pip/issues/8272 now that https://github.com/python/typing/pull/722 is merged?
I could do that, if @JukkaL and/or @ilevkivskyi agree that now's a good time.
Yes, thanks, this is a good time.
I wonder if there's a way to make this package refuse to install itself on any Python version that has a typing module in the stdlib. (I think starting with 3.5.)
This is the right answer
@maxwellmckinnon I'm still a wheels newbie. Do you know how to do that from a wheel?
Never mind the answer is a few comments up.
Okay, I've done a release of typing 3.7.4.2. I changed python_requirements so that it only installs on 2.7 and 3.4. I couldn't find an installable binary of 3.4 (it's well out of support) so I only tested on 2.7 -- if anyone is still using 3.4 and finds a problem they know where to find us. For this reason there also isn't a wheel for 3.4, only an sdist. The changes I made to setup.py are now in master and tagged "3.7.4.2".
FWIW, there were complaints about the version restrictions I applied (last minute) to 3.7.4.2, so I've released 3.7.4.3 which undoes that (but is otherwise the same). There's still no py3 wheel.
Most helpful comment
I could do that, if @JukkaL and/or @ilevkivskyi agree that now's a good time.