threestudio-project / threestudio

A unified framework for 3D content generation.
Apache License 2.0
6.32k stars 480 forks source link

error when launching gradio app #350

Open vlxxc opened 11 months ago

vlxxc commented 11 months ago

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

grebz-dev commented 11 months ago

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

Ethan-Otto commented 11 months ago

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.

Ainaemaet commented 11 months ago

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...

v4r4rth commented 11 months ago

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)
anilkarip commented 11 months ago

Same here. Wsl Ubuntu docker giving same errors.

mashb1t commented 11 months ago

same for me

bennyguo commented 11 months ago

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!

v4r4rth commented 10 months ago

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)

jmorgan-wellovate commented 10 months ago

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

FishWoWater commented 10 months ago

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

Ethan-Otto commented 10 months ago

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

umutyazgan commented 3 months ago

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