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

FIXED: Pydantic issubclass error for python 3.8 and 3.9 #12659

Closed
adrianeboyd opened this issue May 23, 2023 · 13 comments
Closed

FIXED: Pydantic issubclass error for python 3.8 and 3.9 #12659

adrianeboyd opened this issue May 23, 2023 · 13 comments
Labels
bug Bugs and behaviour differing from documentation third-party Third-party packages and services

Comments

@adrianeboyd
Copy link
Contributor

adrianeboyd commented May 23, 2023

UPDATE: This is now fixed for spacy v3.4 and v3.5 with the release of Pydantic v1.10.8.

New installs with pip install spacy should work without issue.

To fix an existing venv for spacy v3.4 or v3.5, please upgrade Pydantic to the latest compatible version with:

python -m pip install -U pydantic spacy

Or for a specific version of spacy:

python -m pip install -U pydantic spacy==3.4.4

For spacy v3.2 and v3.3, we have published patch releases with fixes for the typing_extension requirement. Upgrade to spacy v3.2.6+ or v3.3.3+:

python -m pip install 'spacy~=3.2.6'
python -m pip install 'spacy~=3.3.3'

Original report:

There appears to be a bug in Pydantic v1.10.7 and earlier related to the recent release of typing_extensions v4.6.0 that causes errors for import spacy and any other spacy commands for python 3.8 and python 3.9.

We're hoping that there will be an upstream fix soon. You can follow this issue for more details: pydantic/pydantic#5821

As a workaround, you can add typing_extensions<4.6.0 to your requirements.


The error traceback looks like this:

  File "pydantic/main.py", line 197, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/fields.py", line 506, in pydantic.fields.ModelField.infer
  File "pydantic/fields.py", line 436, in pydantic.fields.ModelField.__init__
  File "pydantic/fields.py", line 552, in pydantic.fields.ModelField.prepare
  File "pydantic/fields.py", line 661, in pydantic.fields.ModelField._type_analysis
  File "pydantic/fields.py", line 668, 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
@adrianeboyd adrianeboyd added bug Bugs and behaviour differing from documentation third-party Third-party packages and services labels May 23, 2023
oroszgy added a commit to huspacy/huspacy that referenced this issue May 23, 2023
@vamshi9
Copy link

vamshi9 commented May 23, 2023

Did the trick typing_extensions<4.6.0

Failure in spaCy transformer download

@MohamedTaha314
Copy link

Installing typing_extensions==4.4.0 actually worked, thank you

@ow-zara
Copy link

ow-zara commented May 23, 2023

+1 for typing_extensions<4.6.0 thanks @vamshi9

@ggravallon
Copy link

I can confirm the suggested workaround did the trick. Thanks !

martino-vic pushed a commit to LoanDB/gerstnerhungarian that referenced this issue May 23, 2023
martino-vic pushed a commit to LoanDB/gerstnerhungarian that referenced this issue May 23, 2023
@adrianeboyd adrianeboyd changed the title Pydantic issubclass error for python 3.8 and 3.9 FIXED: Pydantic issubclass error for python 3.8 and 3.9 May 23, 2023
@adrianeboyd
Copy link
Contributor Author

This issue should now be resolved with the release of Pydantic v1.10.8.

@rjgsousa
Copy link

+1 for typing_extensions<4.6.0 thanks

@github-actions github-actions bot removed the resolved The issue was addressed / answered label May 23, 2023
@adrianeboyd adrianeboyd added the resolved The issue was addressed / answered label May 25, 2023
@github-actions github-actions bot removed the resolved The issue was addressed / answered label May 25, 2023
@shandou
Copy link

shandou commented May 25, 2023

Thank you very much. Yes +1 for adding typing_extensions<4.6.0 as dependency.

@mituso89
Copy link

Thank you very much for for adding typing_extensions<4.6.0. Really appreciate

@oliverjohnwilson
Copy link

+1 for typing_extensions<4.6.0 - big thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

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

@github-actions github-actions bot closed this as completed Jun 6, 2023
@github-actions github-actions bot removed the resolved The issue was addressed / answered label Jun 6, 2023
d61h6k4 added a commit to RasaHQ/rasa that referenced this issue Jun 16, 2023
d61h6k4 pushed a commit to RasaHQ/rasa that referenced this issue Jun 19, 2023
Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises
d61h6k4 pushed a commit to RasaHQ/rasa that referenced this issue Jun 20, 2023
Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises
d61h6k4 pushed a commit to RasaHQ/rasa that referenced this issue Jun 23, 2023
* Bump version of tensorflow (#12515)

Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises

* Remove dependency on tensorflow-addons (#12514)

Remove dependency on tensorflow-addons

Copy tests for crf and metrics

* Multi-platform image with GitHub Actions (#12528)

* Build both platforms on the same machine

* Bump version of tensorflow (#12515)

Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises

* Remove dependency on tensorflow-addons (#12514)

Remove dependency on tensorflow-addons

Copy tests for crf and metrics

* Multi-platform image with GitHub Actions (#12528)

* Build both platforms on the same machine

* Update poetry

* Add changelog

---------

Co-authored-by: Sanchari <s.ghosh@rasa.com>
@daxiaraoming
Copy link

Installing typing_extensions==4.4.0 actually worked, thank you

fastapi 0.99.1 requires typing-extensions>=4.5.0, but you have typing-extensions 4.4.0 which is incompatible.

4.5.0 worked fine

angus-lherrou added a commit to Machine-Learning-for-Medical-Language/cnlp_transformers that referenced this issue Jul 6, 2023
@sjkoelle
Copy link

sjkoelle commented Jul 19, 2023

leaving typing extensions at 4.7 and upgrading the pydantic version worked for me!

@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 Aug 19, 2023
mikealfare added a commit to dbt-labs/dbt-spark that referenced this issue Jun 24, 2024
mikealfare added a commit to dbt-labs/dbt-spark that referenced this issue Jun 26, 2024
* update the spark version to the current version
* update pin for pydantic to resolve explosion/spaCy#12659
* exclude koalas dataframes from test
mikealfare added a commit to dbt-labs/dbt-spark that referenced this issue Oct 24, 2024
* update the spark version to the current version
* update pin for pydantic to resolve explosion/spaCy#12659
* exclude koalas dataframes from test

(cherry picked from commit 824ca0f)
VersusFacit added a commit to dbt-labs/dbt-spark that referenced this issue Oct 26, 2024
…#1055) (#1130)

* Update the spark version to the current version (#1055)

* update the spark version to the current version
* update pin for pydantic to resolve explosion/spaCy#12659
* exclude koalas dataframes from test

(cherry picked from commit 824ca0f)

* Backport preleases.

* Fix numpy issue.

---------

Co-authored-by: VersusFacit <67295367+VersusFacit@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs and behaviour differing from documentation third-party Third-party packages and services
Projects
None yet
Development

No branches or pull requests