edgedb-examples icon indicating copy to clipboard operation
edgedb-examples copied to clipboard

FastAPI CRUD name 'uuid' is not defined

Open Diwas2055 opened this issue 2 years ago • 2 comments

File "/home/user/Desktop/edgeb_fastapiCrud/app/main.py", line 9, in from app import events, users File "/home/user/Desktop/edgeb_fastapiCrud/app/events.py", line 33, in @router.get("/events")

raise PydanticUndefinedAnnotation.from_name_error(e) from e pydantic.errors.PydanticUndefinedAnnotation: name 'uuid' is not defined

For further information visit https://errors.pydantic.dev/2.0.3/u/undefined-annotation

Diwas2055 avatar Jul 17 '23 03:07 Diwas2055

Thank you for reporting this! It seems to be an issue between FastAPI and Pydantic that is breaking the project. We're looking into it…

raddevon avatar Jul 25 '23 13:07 raddevon

The issue seems to be that FastAPI compatibility with Pydantic V2 is not quite there yet. If you force reinstall V1 of Pydantic, that should get you up and running with the example while FastAPI gets it sorted out. We are working on filing a bug with them, but they've already acknowledged the problem in their discussion so they are probably already working to fix it.

Here's the command to force install the older version of Pydantic with pip:

pip install --force-reinstall -v "pydantic==1.10"

raddevon avatar Jul 25 '23 14:07 raddevon