TypeError: issubclass() arg 1 must be a class error when downloading spacy language model
search cancel

TypeError: issubclass() arg 1 must be a class error when downloading spacy language model

book

Article ID: 267049

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

While attempting to install the spacy language model "en_core_web_md" the following may appear:

(botenv) PS C:\va> python -m spacy download en_core_web_md
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "C:\va\botenv\lib\site-packages\spacy\__init__.py", line 14, in <module>
    from . import pipeline  # noqa: F401
  File "C:\va\botenv\lib\site-packages\spacy\pipeline\__init__.py", line 1, in <module>
    from .attributeruler import AttributeRuler
  File "C:\va\botenv\lib\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 "C:\va\botenv\lib\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 "C:\va\botenv\lib\site-packages\spacy\schemas.py", line 250, in <module>
    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 "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\typing.py", line 771, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class

Environment

CA Service Desk Manager 17.3 and higher

Python 3.8 implementation

Cause

This is a problem that is caused by a compatibility issue with one of the backend packages in python, package "pydantic"

Resolution

To fix TypeError: issubclass() arg 1 must be a class

python -m pip install -U pydantic spacy

After running this, the command should execute successfully:

python -m spacy download en_core_web_md

Additional Information

The above is derived from the article:  

https://github.com/explosion/spaCy/issues/12659