Miksus / rocketry

Modern scheduling library for Python
https://rocketry.readthedocs.io
MIT License
3.27k stars 106 forks source link

TypeError: issubclass() arg 1 must be a class #202

Closed hasansezertasan closed 11 months ago

hasansezertasan commented 1 year ago

Describe the bug When I try to import the module I face with this error:

Python 3.8.16 (default, May  4 2023, 06:20:30) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import rocketry
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/rocketry/__init__.py", line 1, in <module>
    from .session import Session
  File "/usr/local/lib/python3.8/site-packages/rocketry/session.py", line 18, in <module>
    from rocketry.log.defaults import create_default_handler
  File "/usr/local/lib/python3.8/site-packages/rocketry/log/defaults.py", line 1, in <module>
    from redbird.logging import RepoHandler
  File "/usr/local/lib/python3.8/site-packages/redbird/__init__.py", line 2, in <module>
    from .base import BaseRepo, BaseResult
  File "/usr/local/lib/python3.8/site-packages/redbird/base.py", line 116, in <module>
    class BaseRepo(ABC, BaseModel):
  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 668, in pydantic.fields.ModelField._type_analysis
  File "/usr/local/lib/python3.8/typing.py", line 774, in __subclasscheck__
    return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class
>>> import rocketry
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/rocketry/__init__.py", line 1, in <module>
    from .session import Session
  File "/usr/local/lib/python3.8/site-packages/rocketry/session.py", line 18, in <module>
    from rocketry.log.defaults import create_default_handler
  File "/usr/local/lib/python3.8/site-packages/rocketry/log/defaults.py", line 1, in <module>
    from redbird.logging import RepoHandler
  File "/usr/local/lib/python3.8/site-packages/redbird/__init__.py", line 2, in <module>
    from .base import BaseRepo, BaseResult
  File "/usr/local/lib/python3.8/site-packages/redbird/base.py", line 116, in <module>
    class BaseRepo(ABC, BaseModel):
  File "/usr/local/lib/python3.8/site-packages/redbird/base.py", line 156, in BaseRepo
    def set_id_field(cls, value, values):
  File "pydantic/class_validators.py", line 93, in pydantic.class_validators.validator.dec
  File "pydantic/class_validators.py", line 156, in pydantic.class_validators._prepare_validator
pydantic.errors.ConfigError: duplicate validator function "redbird.base.BaseRepo.set_id_field"; if this is intended, set `allow_reuse=True`

To Reproduce Import the module.

Expected behavior Import the module.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

timoho98 commented 1 year ago

I was able to fix this by installing typing_extensions==4.5.0, it seems like maybe the version you have installed does not work with this version of rocketry

hasansezertasan commented 11 months ago

It's been a long time and I had to switch to APScheduler because of this error but thank you for your answer @timoho98