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

Fails on Python 3.11 #11664

Closed
JelleZijlstra opened this issue Oct 18, 2022 · 6 comments
Closed

Fails on Python 3.11 #11664

JelleZijlstra opened this issue Oct 18, 2022 · 6 comments
Labels
compat Cross-platform and cross-Python compatibility third-party Third-party packages and services

Comments

@JelleZijlstra
Copy link

How to reproduce the behaviour

  • python3.11 -m pip install spacy
  • Open a shell and run import spacy
Python 3.11.0rc2 (v3.11.0rc2:ed7c3ff156, Sep 11 2022, 16:22:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import spacy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/spacy/__init__.py", line 14, in <module>
    from . import pipeline  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/spacy/pipeline/__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/spacy/pipeline/attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy/pipeline/pipe.pyx", line 1, in init spacy.pipeline.pipe
  File "spacy/vocab.pyx", line 1, in init spacy.vocab
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/spacy/tokens/__init__.py", line 1, in <module>
    from .doc import Doc
  File "spacy/tokens/doc.pyx", line 36, in init spacy.tokens.doc
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/spacy/schemas.py", line 158, in <module>
    class TokenPatternString(BaseModel):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pydantic/main.py", line 292, in __new__
    cls.__signature__ = ClassAttribute('__signature__', generate_model_signature(cls.__init__, fields, config))
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pydantic/utils.py", line 258, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 2715, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'in' is not a valid parameter name

The class it's choking on is here:

class TokenPatternString(BaseModel):
The IN field has an alias in, which is causing problems.

This behavior was changed in python/cpython#92062 (which I approved, sorry for that).

Your Environment

  • Operating System: macOS 12.6
  • Python Version Used: 3.11rc2
  • spaCy Version Used: 3.4.1
  • Environment Information:
@JelleZijlstra
Copy link
Author

This is actually fixed in pydantic 1.10.2 (pydantic/pydantic#4012), but spaCy currently requires pydantic <1.10.0. Relaxing that requirement should fix this issue. I found that PR #11635 already relaxed the requirement, so the next release that incorporates that PR should also fix this issue.

@polm polm added third-party Third-party packages and services compat Cross-platform and cross-Python compatibility labels Oct 18, 2022
@polm
Copy link
Contributor

polm commented Oct 18, 2022

Thanks for the heads-up! We are doing a little testing for 3.11 ourselves, but every bit of information like this helps.

@adrianeboyd
Copy link
Contributor

Updates for python 3.11 for all our packages are in progress (the only remaining ones are srsly, thinc, and spacy) and should be ready by the official release date.

@adrianeboyd
Copy link
Contributor

This should be resolved by the release of spacy v3.4.2. Please let us know if you run into any problems!

@adrianeboyd adrianeboyd added the resolved The issue was addressed / answered label Oct 20, 2022
@github-actions
Copy link
Contributor

This issue has been automatically closed because it was answered and there was no follow-up discussion.

@github-actions github-actions bot removed the resolved The issue was addressed / answered label Oct 28, 2022
@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compat Cross-platform and cross-Python compatibility third-party Third-party packages and services
Projects
None yet
Development

No branches or pull requests

3 participants