Closed long2ice closed 1 year ago
Hi, I am using pydantic2.0, but still have this error, please help!
from app.models import AnyUser, Token, User_Pydantic, Token_Pydantic, UserIn_Pydantic
File "/Users/qilong/Desktop/fastApiUser/app/models.py", line 34, in
KeyError: '__module__'
Did you use latest code?
Did you use latest code?
Yes, I used the latest code. Maybe you have any other ideas?
When I downgraded pydantic==2.0.0, I got this
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. fastapi 0.100.0 requires pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4, but you have pydantic 2.0 which is incompatible.
so I have to install pydantic==1.10.11, and this solves the problem.
Do you have any other ideas?
FastAPI (0.100.0) dependency list shows that it excluded Pydantic (2.0.0, 2.0.1) so first of all using the latest stable version of both frameworks would be a rational choice, which in case of Pydantic it is (2.0.3) While the maintaners of TortoiseORM are working on finalizing the version bump to support Pydantic V2 ,for clarification of conflicts, you can refer to the list of breaking changes with corresponding migration guides, based on Pydantic official docs.
https://docs.pydantic.dev/latest/migration/#migration-guide Good Luck
FastAPI (0.100.0) dependency list shows that it excluded Pydantic (2.0.0, 2.0.1) so first of all using the latest stable version of both frameworks would be a rational choice, which in case of Pydantic it is (2.0.3) While the maintaners of TortoiseORM are working on finalizing the version bump to support Pydantic V2 ,for clarification of conflicts, you can refer to the list of breaking changes with corresponding migration guides, based on Pydantic official docs.
https://docs.pydantic.dev/latest/migration/#migration-guide Good Luck
Description
Support pydantic2.0
Motivation and Context
https://github.com/tortoise/tortoise-orm/discussions/1419
How Has This Been Tested?
Checklist: