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

Still encounter "TypeError: issubclass() arg 1 must be a class" problem with pydantic == 2.9.2 and scapy == 3.7.6 #13635

Open
LuoXiaoxi-cxq opened this issue Sep 26, 2024 Discussed in #13634 · 0 comments

Comments

@LuoXiaoxi-cxq
Copy link

LuoXiaoxi-cxq commented Sep 26, 2024

Discussed in #13634

Originally posted by LuoXiaoxi-cxq September 26, 2024
I was running the training part of the [self-attentive-parser] (https://github.com/nikitakit/self-attentive-parser), where I met this error (probably caused by version problems of spacy and pydantic):

Traceback (most recent call last):
  File "D:\postgraduate\research\parsing\self-attentive-parser\src\main.py", line 11, in <module>
    from benepar import char_lstm
  File "D:\postgraduate\research\parsing\self-attentive-parser\src\benepar\__init__.py", line 20, in <module>
    from .integrations.spacy_plugin import BeneparComponent, NonConstituentException
  File "D:\postgraduate\research\parsing\self-attentive-parser\src\benepar\integrations\spacy_plugin.py", line 5, in <module>
    from .spacy_extensions import ConstituentData, NonConstituentException
  File "D:\postgraduate\research\parsing\self-attentive-parser\src\benepar\integrations\spacy_extensions.py", line 177, in <module>
    install_spacy_extensions()
  File "D:\postgraduate\research\parsing\self-attentive-parser\src\benepar\integrations\spacy_extensions.py", line 153, in install_spacy_extensions
    from spacy.tokens import Doc, Span, Token
  File "D:\anaconda\lib\site-packages\spacy\__init__.py", line 14, in <module>
    from . import pipeline  # noqa: F401
  File "D:\anaconda\lib\site-packages\spacy\pipeline\__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "D:\anaconda\lib\site-packages\spacy\pipeline\attributeruler.py", line 6, in <module>
    from .pipe import Pipe
  File "spacy\pipeline\pipe.pyx", line 8, in init spacy.pipeline.pipe
  File "D:\anaconda\lib\site-packages\spacy\training\__init__.py", line 11, in <module>
    from .callbacks import create_copy_from_base_model  # noqa: F401
  File "D:\anaconda\lib\site-packages\spacy\training\callbacks.py", line 3, in <module>
    from ..language import Language
  File "D:\anaconda\lib\site-packages\spacy\language.py", line 25, in <module>
    from .training.initialize import init_vocab, init_tok2vec
  File "D:\anaconda\lib\site-packages\spacy\training\initialize.py", line 14, in <module>
    from .pretrain import get_tok2vec_ref
  File "D:\anaconda\lib\site-packages\spacy\training\pretrain.py", line 16, in <module>
    from ..schemas import ConfigSchemaPretrain
  File "D:\anaconda\lib\site-packages\spacy\schemas.py", line 216, in <module>
    class TokenPattern(BaseModel):
  File "pydantic\main.py", line 299, in pydantic.main.ModelMetaclass.__new__
    print("Loaded {:,} test examples.".format(len(test_treebank)))
  File "pydantic\fields.py", line 411, in pydantic.fields.ModelField.infer
  File "pydantic\fields.py", line 342, in pydantic.fields.ModelField.__init__
  File "pydantic\fields.py", line 451, in pydantic.fields.ModelField.prepare
  File "pydantic\fields.py", line 545, in pydantic.fields.ModelField._type_analysis
  File "pydantic\fields.py", line 550, in pydantic.fields.ModelField._type_analysis
  File "D:\anaconda\lib\typing.py", line 852, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class

This issue says installing two packages chromadb and pydantic will work, so I installed them. I ran

python -m pip install -U pydantic spacy
python -m pip install -U chromadb spacy

I am running on Windows 11. Now, my environment is

Python == 3.10.14
pydantic == 2.9.2                   
pydantic-core ==  2.23.4 
scapy == 3.7.6
typing-extensions == 4.12.2
chromadb == 0.5.9 

However, the problem still exists. According to this issue, the problem ("TypeError: issubclass() arg 1 must be a class") should only exist for pydantic v1.10.7 and earlier related to the recent release of typing_extensions v4.6.0. My versions are higher, but this error isn't solved.

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

1 participant