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

Error importing Spacy after installation #12662

Closed
rajatjaiswal96 opened this issue May 23, 2023 · 3 comments
Closed

Error importing Spacy after installation #12662

rajatjaiswal96 opened this issue May 23, 2023 · 3 comments

Comments

@rajatjaiswal96
Copy link

Description:
I encountered an error while trying to import Spacy after installing it using the following command:
RUN python3 -m pip install -U 'spacy[cuda110,transformers,lookups]'

The error occurs at the line import spacy in my code, and the traceback shows the following error message:
File "/pipelines/component/src/spacy_ner.py", line 7, in
import spacy
...
TypeError: issubclass() arg 1 must be a class

Full TraceBack:
But getting below error while in "import spacy "
File "/pipelines/component/src/spacy_ner.py", line 7, in
import spacy
File "/usr/local/lib/python3.8/dist-packages/spacy/init.py", line 14, in
from . import pipeline # noqa: F401
File "/usr/local/lib/python3.8/dist-packages/spacy/pipeline/init.py", line 1, in
from .attributeruler import AttributeRuler
File "/usr/local/lib/python3.8/dist-packages/spacy/pipeline/attributeruler.py", line 6, in
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 "/usr/local/lib/python3.8/dist-packages/spacy/tokens/init.py", line 1, in
from .doc import Doc
File "spacy/tokens/doc.pyx", line 36, in init spacy.tokens.doc
File "/usr/local/lib/python3.8/dist-packages/spacy/schemas.py", line 250, in
class TokenPattern(BaseModel):
File "pydantic/main.py", line 205, in pydantic.main.ModelMetaclass.new
File "pydantic/fields.py", line 491, in pydantic.fields.ModelField.infer
File "pydantic/fields.py", line 421, in pydantic.fields.ModelField.init
File "pydantic/fields.py", line 537, in pydantic.fields.ModelField.prepare
File "pydantic/fields.py", line 634, in pydantic.fields.ModelField._type_analysis
File "pydantic/fields.py", line 641, in pydantic.fields.ModelField._type_analysis
File "/usr/lib/python3.8/typing.py", line 774, in subclasscheck
return issubclass(cls, self.origin)
TypeError: issubclass() arg 1 must be a class

I believe this issue is related to the typing extension version in the repository. It seems that the correct version of typing-extension for this setup should be 4.5.0.

To reproduce the issue, please follow these steps:

Install Spacy using the command mentioned above.
Attempt to import Spacy in your code.
I kindly request updating the repository with the correct typing-extension version (4.5.0) to resolve this issue. Thank you for your attention to this matter.

@PandaWhoCodes
Copy link

thanks for pointing this out.

@adrianeboyd
Copy link
Contributor

Let me merge this with #12659...

@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 Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants