Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Conflict: Gradio and Pydantic in demo-srpgt Environment #12

Open
adamshovav opened this issue Dec 29, 2024 · 4 comments
Open

Comments

@adamshovav
Copy link

adamshovav commented Dec 29, 2024

Description

It seems like the demo-srpgt environment may not fully resolve the dependency conflict between Gradio and Pydantic. While the README provides a solution for this, I encountered issues after successfully building the Gradio demo. Upon running it, any submission triggers a pydantic error.

An error I am now seeing is pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

Steps to Reproduce
1. Follow the instructions in the README to set up the demo-srpgt environment.
2. Build and run the Gradio demo.
3. Attempt any interaction in the demo.
4. Observe the error related to Pydantic

If there’s an existing solution for this issue that I might have overlooked, please let me know. Alternatively, guidance on resolving this dependency conflict would be greatly appreciated.

@hsiangwei0903
Copy link

pydantic==2.9.0
pydantic-core==2.23.2
gradio==4.43.0
works for me

@AnjieCheng
Copy link
Owner

Could you check if fastapi version 0.112.0 is installed? I will update the dependencies soon.

@harmlessSR
Copy link

harmlessSR commented Jan 18, 2025

Could you check if fastapi version 0.112.0 is installed? I will update the dependencies soon.

I met the same problem and yes I see fastapi 0.112.4 in my environment.
Looking forward to the depency update!

pydantic==2.9.0 pydantic-core==2.23.2 gradio==4.43.0 works for me

This works for me too.

@mc451742
Copy link

mc451742 commented Mar 5, 2025

I got the similar question, which produces:

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion.

For further information visit https://errors.pydantic.dev/2.10/u/schema-for-unknown-type

Just follow the guidance from README to reproduce the demo of spatialRGPT.

My environment is:
pydantic==2.10.6
pydantic-core==2.27.2
gradio==4.27.0
fastapi==0.115.11

Not sure why it does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants