l1na-forever / stable-diffusion-rocm-docker

Stable Diffusion Docker image preconfigured for usage with AMD Radeon cards
126 stars 23 forks source link

cannot import name 'deprecated' from 'typing_extensions' #22

Open picarica opened 1 year ago

picarica commented 1 year ago

hello i tried it with alisa alias drun='docker run -e HSA_OVERRIDE_GFX_VERSION=10.3.0 -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $(pwd):/pwd' and ran with drun --name stable-diffusion l1naforever/stable-diffusion-rocm:latest but i got this issue

Installing requirements for Web UI Launching Web UI with arguments: --precision full --no-half Traceback (most recent call last): File "launch.py", line 169, in <module> start_webui() File "launch.py", line 163, in start_webui import webui File "/sd/webui.py", line 8, in <module> from fastapi.middleware.gzip import GZipMiddleware File "/opt/conda/lib/python3.7/site-packages/fastapi/__init__.py", line 7, in <module> from .applications import FastAPI as FastAPI File "/opt/conda/lib/python3.7/site-packages/fastapi/applications.py", line 16, in <module> from fastapi import routing File "/opt/conda/lib/python3.7/site-packages/fastapi/routing.py", line 22, in <module> from fastapi import params File "/opt/conda/lib/python3.7/site-packages/fastapi/params.py", line 5, in <module> from pydantic.fields import FieldInfo File "/opt/conda/lib/python3.7/site-packages/pydantic/__init__.py", line 13, in <module> from . import dataclasses File "/opt/conda/lib/python3.7/site-packages/pydantic/dataclasses.py", line 11, in <module> from ._internal import _config, _decorators, _typing_extra File "/opt/conda/lib/python3.7/site-packages/pydantic/_internal/_config.py", line 9, in <module> from ..config import ConfigDict, ExtraValues, JsonEncoder, JsonSchemaExtraCallable File "/opt/conda/lib/python3.7/site-packages/pydantic/config.py", line 9, in <module> from .deprecated.config import BaseConfig File "/opt/conda/lib/python3.7/site-packages/pydantic/deprecated/config.py", line 6, in <module> from typing_extensions import Literal, deprecated ImportError: cannot import name 'deprecated' from 'typing_extensions' (/opt/conda/lib/python3.7/site-packages/typing_extensions.py) couldn find much on google not sure why

i have RX 6500 and i am using rocm versions 5.4.2 on gentoo

kaiser62 commented 1 year ago

Same issue, running on Ubuntu 22.04.3 LTS x86_64 GPU: AMD ATI Radeon RX 5700XT

kyle170 commented 1 year ago

Also getting this issue

omgitsaheadcrab commented 9 months ago

I got this too, using baked rather than latest works though

dkman123 commented 8 months ago

I found this possible solution: https://github.com/tiangolo/fastapi/discussions/9808

In short, running "pip uninstall typing_extensions --yes" and then reinstalling "pip install typing_extensions==4.7.1"

But I can't interactive into the container because it auto-exits so docker thinks it's in a "restarting" state.

I tried baked instead of latest, but I get a different error.

File "/sd/modules/paths.py", line 34, in assert sd_path is not None, f"Couldn't find Stable Diffusion in any of: {possible_sd_paths}" AssertionError: Couldn't find Stable Diffusion in any of: ['/sd/repositories/stable-diffusion-stability-ai', '.', '/']

dkman123 commented 8 months ago

I was able to fumble my way through bypassing the typing_extensions error, but then I got the path error:

assert sd_path is not None, f"Couldn't find Stable Diffusion in any of: {possible_sd_paths}" stable-diffusion | AssertionError: Couldn't find Stable Diffusion in any of: ['/sd/repositories/stable-diffusion-stability-ai', '.', '/']

NOTE: /sd/repositories/stable-diffusion-stability-ai does not exist. /sd/repositories/stable-diffusion does though.

I'm certainly not saying that this is the right way, but this is what I did:

# override the entry point so it won't crash right away
update my docker-compose.yml to add "entrypoint: /bin/sleep 1h"
# stop and recreate the container
sudo docker-compose -f docker-compose.yml stop stable-diffusion
sudo docker-compose -f docker-compose.yml up -d stable-diffusion
# enter the container
sudo docker exec -it stable-diffusion /bin/bash
# force the pip module version
pip uninstall typing_extensions --yes
pip install typing_extensions==4.7.1
# copy the folder outside the container (using outputs as temporary storage)
mkdir /sd/outputs/site-packages
cp -R /opt/conda/lib/python3.7/site-packages/* /sd/site-packages/.
exit
# then outside the container (set your {folder} to wherever your files live)
# move the folder outside of outputs
mv {folder}/outputs/site-packages/* {folder}/site-packages/.
# make sure you don't have a /site-packages/site-packages/ situation going on
# add to the docker-compose.yml volumes
- {folder}/site-packages:/opt/conda/lib/python3.7/site-packages

Just looking for where that folder name exists:

root@19dc15f6c996:/sd# grep -r --include \*.py --include \*.sh "stable-diffusion-stability-ai" *
modules/sd_models.py:    # stable-diffusion-stability-ai hard-codes the midas model path to
modules/paths.py:possible_sd_paths = [os.path.join(script_path, 'repositories/stable-diffusion-stability-ai'), '.', os.path.dirname(script_path)]
modules/launch_utils.py:    git_clone(stable_diffusion_repo, repo_dir('stable-diffusion-stability-ai'), "Stable Diffusion", stable_diffusion_commit_hash)

But I don't know what to do with that information.