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

ImportError: cannot import name 'parse_obj_as' from 'pydantic' (/opt/conda/lib/python3.10/site-packages/pydantic/__init__.py) #746

Open
2 tasks done
RashiqAzhan opened this issue Nov 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@RashiqAzhan
Copy link

Has this issue been opened before?

  • It is not in the FAQ, I checked.
  • It is not in the issues, I searched.

Describe the bug

The container fails to run with the following error.

auto-cpu-1  | Traceback (most recent call last):
auto-cpu-1  |   File "/stable-diffusion-webui/./extensions/canvas-zoom/install.py", line 4, in <module>
auto-cpu-1  |     import gradio
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module>
auto-cpu-1  |     import gradio.components as components
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/gradio/components/__init__.py", line 1, in <module>
auto-cpu-1  |     from gradio.components.annotated_image import AnnotatedImage
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/gradio/components/annotated_image.py", line 12, in <module>
auto-cpu-1  |     from gradio import utils
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/gradio/utils.py", line 40, in <module>
auto-cpu-1  |     from pydantic import BaseModel, parse_obj_as
auto-cpu-1  | ImportError: cannot import name 'parse_obj_as' from 'pydantic' (/opt/conda/lib/python3.10/site-packages/pydantic/__init__.py)
auto-cpu-1 exited with code 1

I've put the following two lines inside the automatic1111 folder's dockerfile as suggested in other issues here and here.

WORKDIR /
RUN --mount=type=cache,target=/root/.cache/pip \
  git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git && \
  cd stable-diffusion-webui && \
  git reset --hard v1.9.4 && \
  pip install -r requirements_versions.txt && \
  pip install --upgrade typing-extensions && \
  pip install -U pydantic==1

Which UI

auto-cpu.

Hardware / Software

  • OS: CachyOS Linux x86_64
  • OS version: rolling
  • Docker Version: 27.3.1
  • Docker compose version: 2.29.7
  • Repo version: 802d0bc, master, tag: 9.0.0
  • RAM: 64 GB
  • GPU/VRAM: N/A

Steps to Reproduce

  1. git clone or git reset --hard origin/master
  2. Add the following to fix the other issues that occur.

pip install --upgrade typing-extensions &&
pip install -U pydantic==1
```
3. docker compose --profile download up --build and `docker compose --profile auto-cpu up --build`
4. See error

Additional context
Adding pip install -U albumentations==1.4.3 in the dockerfile as stated here after the pydantic does not help.

@RashiqAzhan RashiqAzhan added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant