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

_abc_registry errors with py3.8 #721

Closed
awais786 opened this issue May 2, 2020 · 19 comments
Closed

_abc_registry errors with py3.8 #721

awais786 opened this issue May 2, 2020 · 19 comments

Comments

@awais786
Copy link

awais786 commented May 2, 2020

    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'
@awais786 awais786 changed the title facing errors with py3.8 _abc_registry errors with py3.8 May 2, 2020
@gvanrossum
Copy link
Member

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.

@simkessy
Copy link

simkessy commented May 21, 2020

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.

@gvanrossum
Copy link
Member

The solution is probably pip uninstall typing.

@simkessy
Copy link

This worked. Any idea why this might happen all of a sudden?

@gvanrossum
Copy link
Member

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).

@gvanrossum
Copy link
Member

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.)

@ethanhs
Copy link
Contributor

ethanhs commented May 21, 2020

The python_requires for typing

python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
allows it to be installed on 3.4+

It was changed in #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?

@JukkaL
Copy link
Contributor

JukkaL commented May 26, 2020

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.

@gvanrossum
Copy link
Member

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.

@JelleZijlstra
Copy link
Member

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.

@JukkaL
Copy link
Contributor

JukkaL commented May 27, 2020

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.)

@basnijholt
Copy link

basnijholt commented Jul 7, 2020

Would releasing a new version of typing fix (or avoid) pypa/pip#8272 now that #722 is merged?

@gvanrossum
Copy link
Member

I could do that, if @JukkaL and/or @ilevkivskyi agree that now's a good time.

@ilevkivskyi
Copy link
Member

Yes, thanks, this is a good time.

@maxwellmckinnon
Copy link

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

@gvanrossum
Copy link
Member

@maxwellmckinnon I'm still a wheels newbie. Do you know how to do that from a wheel?

@gvanrossum
Copy link
Member

Never mind the answer is a few comments up.

@gvanrossum
Copy link
Member

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".

@gvanrossum
Copy link
Member

gvanrossum commented Jul 13, 2020

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.

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

9 participants