Skip to content

pydantic errors on new install

I cleaned-up my environment, and then re-installed it. I see that lightning was upgraded to 2.0.6, pydantic is pinned to 1.10.x. I get the following error:

$ ptbench datamodule list
Traceback (most recent call last):
  File "/Users/andre/mamba/envs/ptbench/bin/ptbench", line 5, in <module>
    from ptbench.scripts.cli import cli
  File "/Users/andre/work/biosignal/software/ptbench/src/ptbench/scripts/cli.py", line 9, in <module>
    from . import (
  File "/Users/andre/work/biosignal/software/ptbench/src/ptbench/scripts/evaluate.py", line 16, in <module>
    from ..data.datamodule import CachingDataModule
  File "/Users/andre/work/biosignal/software/ptbench/src/ptbench/data/datamodule.py", line 13, in <module>
    import lightning
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/__init__.py", line 18, in <module>
    from lightning.app import storage  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/app/__init__.py", line 24, in <module>
    from lightning.app import components  # noqa: E402, F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/app/components/__init__.py", line 1, in <module>
    from lightning.app.components.database.client import DatabaseClient
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/app/components/database/__init__.py", line 1, in <module>
    from lightning.app.components.database.client import DatabaseClient
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/app/components/database/client.py", line 22, in <module>
    from lightning.app.components.database.utilities import _GeneralModel
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/lightning/app/components/database/utilities.py", line 20, in <module>
    from fastapi import Response, status
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/__init__.py", line 7, in <module>
    from .applications import FastAPI as FastAPI
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/applications.py", line 16, in <module>
    from fastapi import routing
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/routing.py", line 32, in <module>
    from fastapi.dependencies.models import Dependant
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/dependencies/models.py", line 4, in <module>
    from fastapi.security.base import SecurityBase
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/security/__init__.py", line 1, in <module>
    from .api_key import APIKeyCookie as APIKeyCookie
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/security/api_key.py", line 3, in <module>
    from fastapi.openapi.models import APIKey, APIKeyIn
  File "/Users/andre/mamba/envs/ptbench/lib/python3.11/site-packages/fastapi/openapi/models.py", line 58, in <module>
    class Contact(BaseModel):
  File "pydantic/main.py", line 186, in pydantic.main.ModelMetaclass.__new__
TypeError: Argument 'bases' has incorrect type (expected list, got tuple)

Shall we upgrade pydantic, or downgrade lightning?