threestudio icon indicating copy to clipboard operation
threestudio copied to clipboard

error when launching gradio app

Open vlxxc opened this issue 1 year ago • 12 comments

when launching gradeio app i get the following error: ImportError: cannot import name 'Schema' from 'pydantic'

vlxxc avatar Dec 02 '23 13:12 vlxxc

I am also experiencing this issue. Installed via docker and running python 3.10

grebz-dev avatar Dec 06 '23 17:12 grebz-dev

Got this issue runing via collab, and docker. Updating gradio, fast api, and lighting seemed to fix it, but now it seems to quit without throwing an error, or giving confirmation that gradio was launched.

Ethan-Otto avatar Dec 10 '23 00:12 Ethan-Otto

Same issue and no answer from the devs. Looks like it's happening to a lot of other people to (in other places), not sure how to fix it...

Ainaemaet avatar Dec 14 '23 22:12 Ainaemaet

Yup, here with the same problem -

(threestudio) root@a100-instance-ajna:~/threestudio# python3 gradio_app.py launch
Traceback (most recent call last):
  File "gradio_app.py", line 13, in <module>
    import gradio as gr
  File "/usr/local/lib/python3.8/dist-packages/gradio/__init__.py", line 3, in <module>
    import gradio._simple_templates
  File "/usr/local/lib/python3.8/dist-packages/gradio/_simple_templates/__init__.py", line 1, in <module>
    from .simpledropdown import SimpleDropdown
  File "/usr/local/lib/python3.8/dist-packages/gradio/_simple_templates/simpledropdown.py", line 6, in <module>
    from gradio.components.base import FormComponent
  File "/usr/local/lib/python3.8/dist-packages/gradio/components/__init__.py", line 1, in <module>
    from gradio.components.annotated_image import AnnotatedImage
  File "/usr/local/lib/python3.8/dist-packages/gradio/components/annotated_image.py", line 11, in <module>
    from gradio import processing_utils, utils
  File "/usr/local/lib/python3.8/dist-packages/gradio/processing_utils.py", line 22, in <module>
    from gradio.data_classes import FileData, GradioModel, GradioRootModel
  File "/usr/local/lib/python3.8/dist-packages/gradio/data_classes.py", line 19, in <module>
    from pydantic import BaseModel, RootModel, ValidationError  # type: ignore
ImportError: cannot import name 'RootModel' from 'pydantic' (/usr/local/lib/python3.8/dist-packages/pydantic/__init__.cpython-38-x86_64-linux-gnu.so)

v4r4rth avatar Dec 15 '23 04:12 v4r4rth

Same here. Wsl Ubuntu docker giving same errors.

anilkarip avatar Dec 16 '23 10:12 anilkarip

same for me

mashb1t avatar Dec 20 '23 16:12 mashb1t

Hi everyone! Sorry for the inconvenience. I already fixed this problem in the latest commit. Please pull the new code and try again. You may also need to reinstall gradio:

pip uninstall gradio gradio_client pydantic pydantic_core 
pip install gradio==4.11.0

Note that if your network cannot connect to huggingface, remember to add HF_HUB_OFFLINE=1 DIFFUSERS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 before the gradio launch command.

The gradio demo is a very basic interface for some text-to-3D pipelines, and does not support image-to-3D yet. Welcome the contribute and make it better!

bennyguo avatar Dec 21 '23 04:12 bennyguo

Still facing the pydantic problem with a new error:

Traceback (most recent call last): File "gradio_app.py", line 13, in import gradio as gr File "/usr/local/lib/python3.8/dist-packages/gradio/init.py", line 3, in import gradio._simple_templates File "/usr/local/lib/python3.8/dist-packages/gradio/_simple_templates/init.py", line 1, in from .simpledropdown import SimpleDropdown File "/usr/local/lib/python3.8/dist-packages/gradio/_simple_templates/simpledropdown.py", line 6, in from gradio.components.base import FormComponent File "/usr/local/lib/python3.8/dist-packages/gradio/components/init.py", line 1, in from gradio.components.annotated_image import AnnotatedImage File "/usr/local/lib/python3.8/dist-packages/gradio/components/annotated_image.py", line 11, in from gradio import processing_utils, utils File "/usr/local/lib/python3.8/dist-packages/gradio/processing_utils.py", line 22, in from gradio.data_classes import FileData, GradioModel, GradioRootModel File "/usr/local/lib/python3.8/dist-packages/gradio/data_classes.py", line 12, in from fastapi import Request File "/usr/local/lib/python3.8/dist-packages/fastapi/init.py", line 5, in from .applications import FastAPI File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 3, in from fastapi import routing File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 6, in from fastapi import params File "/usr/local/lib/python3.8/dist-packages/fastapi/params.py", line 4, in from pydantic import Schema ImportError: cannot import name 'Schema' from 'pydantic' (/usr/local/lib/python3.8/dist-packages/pydantic/init.py)

v4r4rth avatar Dec 22 '23 11:12 v4r4rth

Also having this issue "ImportError: cannot import name 'Schema' from 'pydantic' " .... Using gradio==4.11.0

jmorgan-wellovate avatar Dec 28 '23 02:12 jmorgan-wellovate

the problem seems to stem from old and mismatch version of fastapi (against gradio==4.11.0 and pydantic==2.5.2)

pip install -U fastapi pydantic works well for me

FishWoWater avatar Jan 02 '24 13:01 FishWoWater

On the docker container, I pip install fastapi and pydantic yet when I run gradio I get the following

To create a public link, set share=True in launch(). Exception in thread Thread-4 (_do_normal_analytics_request): Traceback (most recent call last): File "/home/dreamer/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions yield File "/home/dreamer/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 168, in start_tls raise exc File "/home/dreamer/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 163, in start_tls sock = ssl_context.wrap_socket( File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.10/ssl.py", line 1100, in _create self.do_handshake() File "/usr/lib/python3.10/ssl.py", line 1371, in do_handshake self._sslobj.do_handshake() TimeoutError: _ssl.c:990: The handshake operation timed out

Ethan-Otto avatar Jan 13 '24 02:01 Ethan-Otto

the problem seems to stem from old and mismatch version of fastapi (against gradio==4.11.0 and pydantic==2.5.2)

pip install -U fastapi pydantic works well for me

Unfortunately this didn't work for me.

ImportError: /home/dreamer/.local/lib/python3.10/site-packages/tinycudann_bindings/_89_C.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN2at4_ops5zeros4callEN3c108ArrayRefINS2_6SymIntEEENS2_8optionalINS2_10ScalarTypeEEENS6_INS2_6LayoutEEENS6_INS2_6DeviceEEENS6_IbEE

I think the problem is this:

pip install -U fastapi pydantic installs fastapi-0.112.0 and pydantic-2.8.2 pydantic==2.8.2 does not provide 'Schema', pydantic==1.10 provides it. but gradio==4.11.0 requires pydantic>=2.0 also, lightning==2.0.0 requires fastapi<0.89.0

umutyazgan avatar Aug 06 '24 11:08 umutyazgan