Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

typing is part of standard library from python3.6 (gives errors on python3.7) #1638

Merged
merged 2 commits into from
Aug 21, 2018
Merged

typing is part of standard library from python3.6 (gives errors on python3.7) #1638

merged 2 commits into from
Aug 21, 2018

Conversation

MartinoMensio
Copy link
Contributor

installing it on python3.7 causes AttributeError: type object 'Callable' has no attribute '_abc_registry'
refers #1457 and python/typing/issues/573.

To reproduce the issue simply install allennlp in a new environment with python3.7 and then run the command allennlp predict https://s3-us-west-2.amazonaws.com/allennlp/models/srl-model-2018.05.25.tar.gz srl-examples.jsonl given on the demo site https://allennlp.org/models.
It will produce the following error:

Traceback (most recent call last):
  File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/martino/kmi/allennlp_playground/venv/lib/python3.7/site-packages/allennlp/run.py", line 15, in <module>
    from allennlp.commands import main  # pylint: disable=wrong-import-position
  File "/home/martino/kmi/allennlp_playground/venv/lib/python3.7/site-packages/allennlp/commands/__init__.py", line 1, in <module>
    from typing import Dict
  File "/home/martino/kmi/allennlp_playground/venv/lib/python3.7/site-packages/typing.py", line 1347, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/home/martino/kmi/allennlp_playground/venv/lib/python3.7/site-packages/typing.py", line 1003, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'

The solution is not to install the backport package typing on the latest python versions.

installing it on python3.7 causes AttributeError: type object 'Callable' has no attribute '_abc_registry'
refers #1457 and python/typing/issues/573
@joelgrus
Copy link
Contributor

good catch. AllenNLP requires at least Python 3.6 to run in the first place, so can you modify the PR to just remove typing altogether? thanks

@joelgrus joelgrus self-assigned this Aug 21, 2018
@joelgrus joelgrus merged commit 2e47ac4 into allenai:master Aug 21, 2018
gabrielStanovsky pushed a commit to gabrielStanovsky/allennlp that referenced this pull request Sep 7, 2018
…thon3.7) (allenai#1638)

* typing is part of standard library from python3.6
installing it on python3.7 causes AttributeError: type object 'Callable' has no attribute '_abc_registry'
refers allenai#1457 and python/typing/issues/573

* remove typing backport because is part of python3.6 natively and allennlp requires python3.6
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants