执行docker compose --profile auto up --build 遇到 ImportError: cannot import name 'TypeIs' from 'typing_extensions' 如何解决?
stable-diffusion-webui-docker (master) ✔ docker compose --profile auto up --build
[+] Building 1.8s (25/25) FINISHED docker:default
=> [auto internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.96kB 0.0s
=> [auto internal] load metadata for docker.io/pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime 1.7s
=> [auto internal] load metadata for docker.io/alpine/git:2.36.2 1.7s
=> [auto internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [auto download 1/9] FROM docker.io/alpine/git:2.36.2@sha256:ec491c893597b68c92b88023827faa771772cfd5e106b76c713fa5e1c75dea84 0.0s
=> [auto internal] load build context 0.0s
=> => transferring context: 122B 0.0s
=> [auto stage-1 1/11] FROM docker.io/pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime@sha256:0279f7aa29974bf64e61d0ff6e979b41a249b3662a46e30778dbf80b8c99c361 0.0s
=> CACHED [auto stage-1 2/11] RUN --mount=type=cache,target=/var/cache/apt apt-get update && apt-get install -y fonts-dejavu-core rsync git jq moreutils aria2 0.0s
=> CACHED [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- 0.0s
=> CACHED [auto download 2/9] COPY clone.sh /clone.sh 0.0s
=> CACHED [auto download 3/9] RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets.git 6f7db241d2f8ba7457bac5 0.0s
=> CACHED [auto download 4/9] RUN . /clone.sh stable-diffusion-stability-ai https://github.com/Stability-AI/stablediffusion.git cf1d67a6fd5ea1aa600c4df58e5b47da45f6b 0.0s
=> CACHED [auto download 5/9] RUN . /clone.sh BLIP https://github.com/salesforce/BLIP.git 48211a1594f1321b00f14c9f7a5b4813144b2fb9 0.0s
=> CACHED [auto download 6/9] RUN . /clone.sh k-diffusion https://github.com/crowsonkb/k-diffusion.git ab527a9a6d347f364e3d185ba6d714e22d80cb3c 0.0s
=> CACHED [auto download 7/9] RUN . /clone.sh clip-interrogator https://github.com/pharmapsychotic/clip-interrogator 2cf03aaf6e704197fd0dae7c7f96aa59cf1b11c9 0.0s
=> CACHED [auto download 8/9] RUN . /clone.sh generative-models https://github.com/Stability-AI/generative-models 45c443b316737a4ab6e40413d7794a7f5657c19f 0.0s
=> CACHED [auto download 9/9] RUN . /clone.sh stable-diffusion-webui-assets https://github.com/AUTOMATIC1111/stable-diffusion-webui-assets 6f7db241d2f8ba7457bac5ca97 0.0s
=> CACHED [auto stage-1 4/11] COPY --from=download /repositories/ /stable-diffusion-webui/repositories/ 0.0s
=> CACHED [auto stage-1 5/11] RUN mkdir /stable-diffusion-webui/interrogate && cp /stable-diffusion-webui/repositories/clip-interrogator/clip_interrogator/data/* /s 0.0s
=> CACHED [auto stage-1 6/11] RUN --mount=type=cache,target=/root/.cache/pip pip install pyngrok xformers==0.0.26.post1 git+https://github.com/TencentARC/GFPGAN 0.0s
=> CACHED [auto stage-1 7/11] RUN apt-get -y install libgoogle-perftools-dev && apt-get clean 0.0s
=> CACHED [auto stage-1 8/11] COPY . /docker 0.0s
=> CACHED [auto stage-1 9/11] RUN sed -i 's/in_app_dir = .*/in_app_dir = True/g' /opt/conda/lib/python3.10/site-packages/gradio/routes.py && git config --global 0.0s
=> CACHED [auto stage-1 10/11] WORKDIR /stable-diffusion-webui 0.0s
=> [auto] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:6b9d62f486f2bb48461ecac68e8c07e523cc01c166f78cc059efc209fbf89298 0.0s
=> => naming to docker.io/library/sd-auto:78 0.0s
[+] Running 1/0
✔ Container webui-docker-auto-1 Created 0.0s
Attaching to auto-1
auto-1 | /stable-diffusion-webui
auto-1 | total 764K
auto-1 | drwxr-xr-x 1 root root 4.0K Feb 23 11:08 .
auto-1 | drwxr-xr-x 1 root root 4.0K Feb 23 10:46 ..
auto-1 | -rw-r--r-- 1 root root 48 Feb 23 10:44 .eslintignore
auto-1 | -rw-r--r-- 1 root root 3.4K Feb 23 10:44 .eslintrc.js
auto-1 | drwxr-xr-x 8 root root 4.0K Feb 23 10:44 .git
auto-1 | -rw-r--r-- 1 root root 55 Feb 23 10:44 .git-blame-ignore-revs
auto-1 | drwxr-xr-x 4 root root 4.0K Feb 23 10:44 .github
auto-1 | -rw-r--r-- 1 root root 521 Feb 23 10:44 .gitignore
auto-1 | -rw-r--r-- 1 root root 119 Feb 23 10:44 .pylintrc
auto-1 | -rw-r--r-- 1 root root 84K Feb 23 10:44 CHANGELOG.md
auto-1 | -rw-r--r-- 1 root root 243 Feb 23 10:44 CITATION.cff
auto-1 | -rw-r--r-- 1 root root 657 Feb 23 10:44 CODEOWNERS
auto-1 | -rw-r--r-- 1 root root 35K Feb 23 10:44 LICENSE.txt
auto-1 | -rw-r--r-- 1 root root 13K Feb 23 10:44 README.md
auto-1 | -rw-r--r-- 1 root root 146 Feb 23 10:44 _typos.toml
auto-1 | lrwxrwxrwx 1 root root 29 Feb 23 11:08 config.json -> /data/config/auto/config.json
auto-1 | lrwxrwxrwx 1 root root 31 Feb 23 11:08 config_states -> /data/config/auto/config_states
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 configs
auto-1 | lrwxrwxrwx 1 root root 16 Feb 23 11:08 embeddings -> /data/embeddings
auto-1 | -rw-r--r-- 1 root root 167 Feb 23 10:44 environment-wsl2.yaml
auto-1 | lrwxrwxrwx 1 root root 28 Feb 23 11:08 extensions -> /data/config/auto/extensions
auto-1 | drwxr-xr-x 13 root root 4.0K Feb 23 10:44 extensions-builtin
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 html
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:45 interrogate
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 javascript
auto-1 | -rw-r--r-- 1 root root 1.3K Feb 23 10:44 launch.py
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 localizations
auto-1 | lrwxrwxrwx 1 root root 12 Feb 23 11:08 models -> /data/models
auto-1 | drwxr-xr-x 1 root root 4.0K Feb 23 10:46 modules
auto-1 | -rw-r--r-- 1 root root 185 Feb 23 10:44 package.json
auto-1 | -rw-r--r-- 1 root root 841 Feb 23 10:44 pyproject.toml
auto-1 | drwxr-xr-x 1 root root 4.0K Feb 23 10:46 repositories
auto-1 | -rw-r--r-- 1 root root 49 Feb 23 10:44 requirements-test.txt
auto-1 | -rw-r--r-- 1 root root 371 Feb 23 10:44 requirements.txt
auto-1 | -rw-r--r-- 1 root root 42 Feb 23 10:44 requirements_npu.txt
auto-1 | -rw-r--r-- 1 root root 645 Feb 23 10:44 requirements_versions.txt
auto-1 | -rw-r--r-- 1 root root 411K Feb 23 10:44 screenshot.png
auto-1 | -rw-r--r-- 1 root root 6.1K Feb 23 10:44 script.js
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 scripts
auto-1 | -rw-r--r-- 1 root root 43K Feb 23 10:44 style.css
auto-1 | lrwxrwxrwx 1 root root 28 Feb 23 11:08 styles.csv -> /data/config/auto/styles.csv
auto-1 | drwxr-xr-x 4 root root 4.0K Feb 23 10:44 test
auto-1 | drwxr-xr-x 2 root root 4.0K Feb 23 10:44 textual_inversion_templates
auto-1 | lrwxrwxrwx 1 root root 32 Feb 23 11:08 ui-config.json -> /data/config/auto/ui-config.json
auto-1 | -rw-r--r-- 1 root root 670 Feb 23 10:44 webui-macos-env.sh
auto-1 | -rw-r--r-- 1 root root 84 Feb 23 10:44 webui-user.bat
auto-1 | -rw-r--r-- 1 root root 1.4K Feb 23 10:44 webui-user.sh
auto-1 | -rw-r--r-- 1 root root 2.3K Feb 23 10:44 webui.bat
auto-1 | -rw-r--r-- 1 root root 5.3K Feb 23 10:44 webui.py
auto-1 | -rwxr-xr-x 1 root root 11K Feb 23 10:44 webui.sh
auto-1 | Mounted .cache
auto-1 | Mounted config_states
auto-1 | Mounted .cache
auto-1 | Mounted embeddings
auto-1 | Mounted config.json
auto-1 | Mounted models
auto-1 | Mounted styles.csv
auto-1 | Mounted ui-config.json
auto-1 | Mounted extensions
auto-1 | Installing extension dependencies (if any)
auto-1 | Traceback (most recent call last):
auto-1 | File "/stable-diffusion-webui/webui.py", line 13, in <module>
auto-1 | initialize.imports()
auto-1 | File "/stable-diffusion-webui/modules/initialize.py", line 23, in imports
auto-1 | import gradio # noqa: F401
auto-1 | File "/opt/conda/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module>
auto-1 | import gradio.components as components
auto-1 | File "/opt/conda/lib/python3.10/site-packages/gradio/components/__init__.py", line 3, in <module>
FROM alpine/git:2.36.2 as download
auto-1 | from gradio.components.bar_plot import BarPlot
auto-1 | File "/opt/conda/lib/python3.10/site-packages/gradio/components/bar_plot.py", line 7, in <module>
auto-1 | import altair as alt
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/__init__.py", line 649, in <module>
auto-1 | from altair.vegalite import *
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/vegalite/__init__.py", line 2, in <module>
auto-1 | from .v5 import *
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/vegalite/v5/__init__.py", line 2, in <module>
auto-1 | from altair.expr.core import datum
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/expr/__init__.py", line 11, in <module>
auto-1 | from altair.expr.core import ConstExpression, FunctionExpression
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/expr/core.py", line 6, in <module>
auto-1 | from altair.utils import SchemaBase
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/utils/__init__.py", line 14, in <module>
auto-1 | from .plugin_registry import PluginRegistry
auto-1 | File "/opt/conda/lib/python3.10/site-packages/altair/utils/plugin_registry.py", line 13, in <module>
auto-1 | from typing_extensions import TypeIs
auto-1 | ImportError: cannot import name 'TypeIs' from 'typing_extensions' (/opt/conda/lib/python3.10/site-packages/typing_extensions.py)解决方案:
修改在stable-diffusion-webui-docker下面的Dockerfile文件:
vim services/AUTOMATIC1111/Dockerfile加入:
RUN --mount=type=cache,target=/root/.cache/pip \
pip uninstall -y typing_extensions && \
pip install typing_extensions==4.11.0
Ref
ImportError: cannot import name ‘TypeIs’ · Issue #719 · AbdBarho/stable-diffusion-webui-docker
Hi, I have error on command “docker compose --profile auto up --build” ImportError: cannot import name ‘TypeIs’ from ‘typing_extensions’ (/opt/conda/lib/python3.10/site-packages/typing_extensions.p…