AbdBarho / stable-diffusion-webui-docker

Easy Docker setup for Stable Diffusion with user-friendly UI
Other
6.75k stars 1.13k forks source link

docker compose --profile auto-cpu up --build -> ImportError: cannot import name 'TypeIs' from 'typing_extensions' - exited with code 1- #742

Open Kryschuuu opened 1 month ago

Kryschuuu commented 1 month ago

Has this issue been opened before?

Describe the bug when I try $ sudo docker compose --profile auto-cpu up --build then

auto-cpu-1  | ImportError: cannot import name 'TypeIs' from 'typing_extensions' (/opt/conda/lib/python3.10/site-packages/typing_extensions.py)
auto-cpu-1 exited with code 1

Which UI auto-cpu ?

Here is the log

`$ sudo docker compose --profile auto-cpu up --build

`[+] Building 1.2s (26/26) FINISHED                               docker:default
 => [auto-cpu internal] load build definition from Dockerfile              0.0s
 => => transferring dockerfile: 2.96kB                                     0.0s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (li  0.0s
 => [auto-cpu internal] load metadata for docker.io/pytorch/pytorch:2.3.0  0.9s
 => [auto-cpu internal] load metadata for docker.io/alpine/git:2.36.2      0.9s
 => [auto-cpu internal] load .dockerignore                                 0.0s
 => => transferring context: 2B                                            0.0s
 => [auto-cpu download 1/9] FROM docker.io/alpine/git:2.36.2@sha256:ec491  0.0s
 => [auto-cpu internal] load build context                                 0.0s
 => => transferring context: 122B                                          0.0s
 => [auto-cpu stage-1  1/11] FROM docker.io/pytorch/pytorch:2.3.0-cuda12.  0.0s
 => CACHED [auto-cpu stage-1  2/11] RUN --mount=type=cache,target=/var/ca  0.0s
 => CACHED [auto-cpu stage-1  3/11] RUN --mount=type=cache,target=/root/.  0.0s
 => CACHED [auto-cpu download 2/9] COPY clone.sh /clone.sh                 0.0s
 => CACHED [auto-cpu download 3/9] RUN . /clone.sh stable-diffusion-webui  0.0s
 => CACHED [auto-cpu download 4/9] RUN . /clone.sh stable-diffusion-stabi  0.0s
 => CACHED [auto-cpu download 5/9] RUN . /clone.sh BLIP https://github.co  0.0s
 => CACHED [auto-cpu download 6/9] RUN . /clone.sh k-diffusion https://gi  0.0s
 => CACHED [auto-cpu download 7/9] RUN . /clone.sh clip-interrogator http  0.0s
 => CACHED [auto-cpu download 8/9] RUN . /clone.sh generative-models http  0.0s
 => CACHED [auto-cpu download 9/9] RUN . /clone.sh stable-diffusion-webui  0.0s
 => CACHED [auto-cpu stage-1  4/11] COPY --from=download /repositories/ /  0.0s
 => CACHED [auto-cpu stage-1  5/11] RUN mkdir /stable-diffusion-webui/int  0.0s
 => CACHED [auto-cpu stage-1  6/11] RUN --mount=type=cache,target=/root/.  0.0s
 => CACHED [auto-cpu stage-1  7/11] RUN apt-get -y install libgoogle-perf  0.0s
 => CACHED [auto-cpu stage-1  8/11] COPY . /docker                         0.0s
 => CACHED [auto-cpu stage-1  9/11] RUN   sed -i 's/in_app_dir = .*/in_ap  0.0s
 => CACHED [auto-cpu stage-1 10/11] WORKDIR /stable-diffusion-webui        0.0s
 => [auto-cpu] exporting to image                                          0.0s
 => => exporting layers                                                    0.0s
 => => writing image sha256:ceb21662c07f952f9dfe786f6f469a0de15b0964480d8  0.0s
 => => naming to docker.io/library/sd-auto:78                              0.0s
 => [auto-cpu] resolving provenance for metadata file                      0.0s
[+] Running 1/0
 ✔ Container webui-docker-auto-cpu-1  Created                              0.0s 
Attaching to auto-cpu-1
auto-cpu-1  | /stable-diffusion-webui
auto-cpu-1  | total 764K
auto-cpu-1  | drwxr-xr-x  1 root root 4.0K Oct  3 11:55 .
auto-cpu-1  | drwxr-xr-x  1 root root 4.0K Oct  3 10:06 ..
auto-cpu-1  | -rw-r--r--  1 root root   48 Oct  3 10:02 .eslintignore
auto-cpu-1  | -rw-r--r--  1 root root 3.4K Oct  3 10:02 .eslintrc.js
auto-cpu-1  | drwxr-xr-x  8 root root 4.0K Oct  3 10:02 .git
auto-cpu-1  | -rw-r--r--  1 root root   55 Oct  3 10:02 .git-blame-ignore-revs
auto-cpu-1  | drwxr-xr-x  4 root root 4.0K Oct  3 10:02 .github
auto-cpu-1  | -rw-r--r--  1 root root  521 Oct  3 10:02 .gitignore
auto-cpu-1  | -rw-r--r--  1 root root  119 Oct  3 10:02 .pylintrc
auto-cpu-1  | -rw-r--r--  1 root root  84K Oct  3 10:02 CHANGELOG.md
auto-cpu-1  | -rw-r--r--  1 root root  243 Oct  3 10:02 CITATION.cff
auto-cpu-1  | -rw-r--r--  1 root root  657 Oct  3 10:02 CODEOWNERS
auto-cpu-1  | -rw-r--r--  1 root root  35K Oct  3 10:02 LICENSE.txt
auto-cpu-1  | -rw-r--r--  1 root root  13K Oct  3 10:02 README.md
auto-cpu-1  | -rw-r--r--  1 root root  146 Oct  3 10:02 _typos.toml
auto-cpu-1  | lrwxrwxrwx  1 root root   29 Oct  3 11:55 config.json -> /data/config/auto/config.json
auto-cpu-1  | lrwxrwxrwx  1 root root   31 Oct  3 11:55 config_states -> /data/config/auto/config_states
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 configs
auto-cpu-1  | lrwxrwxrwx  1 root root   16 Oct  3 11:55 embeddings -> /data/embeddings
auto-cpu-1  | -rw-r--r--  1 root root  167 Oct  3 10:02 environment-wsl2.yaml
auto-cpu-1  | lrwxrwxrwx  1 root root   28 Oct  3 11:55 extensions -> /data/config/auto/extensions
auto-cpu-1  | drwxr-xr-x 13 root root 4.0K Oct  3 10:02 extensions-builtin
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 html
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:04 interrogate
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 javascript
auto-cpu-1  | -rw-r--r--  1 root root 1.3K Oct  3 10:02 launch.py
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 localizations
auto-cpu-1  | lrwxrwxrwx  1 root root   12 Oct  3 11:55 models -> /data/models
auto-cpu-1  | drwxr-xr-x  1 root root 4.0K Oct  3 10:06 modules
auto-cpu-1  | -rw-r--r--  1 root root  185 Oct  3 10:02 package.json
auto-cpu-1  | -rw-r--r--  1 root root  841 Oct  3 10:02 pyproject.toml
auto-cpu-1  | drwxr-xr-x  1 root root 4.0K Oct  3 10:06 repositories
auto-cpu-1  | -rw-r--r--  1 root root   49 Oct  3 10:02 requirements-test.txt
auto-cpu-1  | -rw-r--r--  1 root root  371 Oct  3 10:02 requirements.txt
auto-cpu-1  | -rw-r--r--  1 root root   42 Oct  3 10:02 requirements_npu.txt
auto-cpu-1  | -rw-r--r--  1 root root  645 Oct  3 10:02 requirements_versions.txt
auto-cpu-1  | -rw-r--r--  1 root root 411K Oct  3 10:02 screenshot.png
auto-cpu-1  | -rw-r--r--  1 root root 6.1K Oct  3 10:02 script.js
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 scripts
auto-cpu-1  | -rw-r--r--  1 root root  43K Oct  3 10:02 style.css
auto-cpu-1  | lrwxrwxrwx  1 root root   28 Oct  3 11:55 styles.csv -> /data/config/auto/styles.csv
auto-cpu-1  | drwxr-xr-x  4 root root 4.0K Oct  3 10:02 test
auto-cpu-1  | drwxr-xr-x  2 root root 4.0K Oct  3 10:02 textual_inversion_templates
auto-cpu-1  | lrwxrwxrwx  1 root root   32 Oct  3 11:55 ui-config.json -> /data/config/auto/ui-config.json
auto-cpu-1  | -rw-r--r--  1 root root  670 Oct  3 10:02 webui-macos-env.sh
auto-cpu-1  | -rw-r--r--  1 root root   84 Oct  3 10:02 webui-user.bat
auto-cpu-1  | -rw-r--r--  1 root root 1.4K Oct  3 10:02 webui-user.sh
auto-cpu-1  | -rw-r--r--  1 root root 2.3K Oct  3 10:02 webui.bat
auto-cpu-1  | -rw-r--r--  1 root root 5.3K Oct  3 10:02 webui.py
auto-cpu-1  | -rwxr-xr-x  1 root root  11K Oct  3 10:02 webui.sh
auto-cpu-1  | Mounted .cache
auto-cpu-1  | Mounted config_states
auto-cpu-1  | Mounted .cache
auto-cpu-1  | Mounted embeddings
auto-cpu-1  | Mounted config.json
auto-cpu-1  | Mounted models
auto-cpu-1  | Mounted styles.csv
auto-cpu-1  | Mounted ui-config.json
auto-cpu-1  | Mounted extensions
auto-cpu-1  | Installing extension dependencies (if any)
auto-cpu-1  | Traceback (most recent call last):
auto-cpu-1  |   File "/stable-diffusion-webui/webui.py", line 13, in <module>
auto-cpu-1  |     initialize.imports()
auto-cpu-1  |   File "/stable-diffusion-webui/modules/initialize.py", line 23, in imports
auto-cpu-1  |     import gradio  # noqa: F401
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 3, in <module>
auto-cpu-1  |     from gradio.components.bar_plot import BarPlot
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/gradio/components/bar_plot.py", line 7, in <module>
auto-cpu-1  |     import altair as alt
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/__init__.py", line 650, in <module>
auto-cpu-1  |     from altair.vegalite import *
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/vegalite/__init__.py", line 2, in <module>
auto-cpu-1  |     from .v5 import *
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/vegalite/v5/__init__.py", line 2, in <module>
auto-cpu-1  |     from altair.expr.core import datum
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/expr/__init__.py", line 7, in <module>
auto-cpu-1  |     from altair.expr.core import ConstExpression, FunctionExpression
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/expr/core.py", line 6, in <module>
auto-cpu-1  |     from altair.utils import SchemaBase
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/utils/__init__.py", line 14, in <module>
auto-cpu-1  |     from .plugin_registry import PluginRegistry
auto-cpu-1  |   File "/opt/conda/lib/python3.10/site-packages/altair/utils/plugin_registry.py", line 6, in <module>
auto-cpu-1  |     from typing_extensions import TypeAliasType, TypeIs, TypeVar
auto-cpu-1  | ImportError: cannot import name 'TypeIs' from 'typing_extensions' (/opt/conda/lib/python3.10/site-packages/typing_extensions.py)
auto-cpu-1 exited with code 1

Hardware / Software

ne-bknn commented 1 month ago

Can confirm the same problem for auto ui on master.

upd.: duplicates #729, workaround is there

m4rtini2 commented 1 month ago

workaround from #729 does not work for me. Changing UI does not make a difference

# docker compose --profile auto up --build

...
>[auto stage-1  3/11] 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:
0.371 Cloning into 'stable-diffusion-webui'...
3.500 HEAD is now at feee37d7 Merge branch 'dev'
4.060 Requirement already satisfied: pip in /opt/conda/lib/python3.10/site-packages (23.3.1)
4.241 Collecting pip
4.243   Using cached pip-24.2-py3-none-any.whl.metadata (3.6 kB)
4.346 ERROR: Could not find a version that satisfies the requirement install (from versions: none)
4.346 ERROR: No matching distribution found for install

failed to solve: process "/bin/sh -c 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" did not complete successfully: exit code: 1

Hardware / Software

ne-bknn commented 1 month ago

@m4rtini2, if you loook closely, you will notice that the command you running is

pip install -r requirements_versions.txt   pip install --upgrade typing-extensions

where it should be

pip install -r requirements_versions.txt && pip install --upgrade typing-extensions

You forgot &&. That's why the workaround is failing.

m4rtini2 commented 1 month ago

@ne-bknn, thank you for the quick help. It works now

karypid commented 3 weeks ago

This workaround has fixed things for me as well.

I think this is raised as: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/16520 in the AUTOMATIC1111/stable-diffusion-webui repo.