Motor-ODM
Motor-ODM copied to clipboard
ImportError: cannot import name 'ModelMetaclass' from 'pydantic.main'
Error when using Motor ODM with latest Pydantic 2.8.2 (and maybe earlier)
ImportError: cannot import name 'ModelMetaclass' from 'pydantic.main'
(/app/.venv/lib/python3.12/site-packages/pydantic/main.py)
dependencies = [
"motor-odm>=0.1.dev0",
"motor>=3.5.1",
"pydantic>=2.8.2",
]
https://github.com/pydantic/pydantic/issues/6381
This issue suggesting updating the import to:
from pydantic._internal._model_construction import ModelMetaclass