0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Stable Diffusionの最新版をローカルに導入したら色々ハマった点について

0
Posted at

はじめに

2026年3月時点の最新のStableDiffusionを入れて動かしてみると実行時エラーが出まくったので、その対処方法を書いてみる

clipがロードできない

起動時に
Couldn't install clip
がでて止まってしまう

どうやら、2026年2月ごろから増えている既知の不具合 らしい
原因は openai/CLIP のビルド時に pkg_resources を使っているのに、最近の setuptools ではそれが削除され、ModuleNotFoundError: No module named 'pkg_resources' になるため
下記の通り、

cd /Users/okuma/StableDiffusion/stable-diffusion-webui

cat > constraints.txt <<'EOF'
setuptools==69.5.1
EOF

rm -rf venv
PIP_CONSTRAINT="$PWD/constraints.txt" ./webui.sh

setuptoolsのバージョンを固定しないといけない

launch.pyの起動でエラーが出る

起動時に
Traceback (most recent call last): File "/Users/StableDiffusion/stable-diffusion-webui/launch.py", line 48, in <module>
がでて止まってしまう

A1111 の main 側が起動時に取りに行く https://github.com/Stability-AI/stablediffusion.git が見つからなくなっている のが原因となる。2025年12月以降、このURLで Error code: 128 になる報告が複数あり、A1111 側でも「dev ブランチでは取得先を更新した」と案内されているそうな。
なので、A1111 を dev ブランチに切り替える必要がある。

修正手順

対処方法はこんな感じで

cd /Users/StableDiffusion/stable-diffusion-webui

git fetch origin
git switch dev
rm -rf repositories/stable-diffusion-stability-ai
rm -rf venv

cat > constraints.txt <<'EOF'
setuptools==69.5.1
EOF

PIP_CONSTRAINT="$PWD/constraints.txt" ./webui.sh

ControlNetが動かない

ControleNet導入後、
ControlNet preprocessor location: /Users/StableDiffusion/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads *** Error loading script: controlnet.py Traceback (most recent call last): File "/Users/StableDiffusion/stable-diffusion-webui/modules/scripts.py", line 515, in load_scripts
というエラーが出る

ControlNet 側が mediapipe.solutions 前提で動いているのに、入っている mediapipe が新しすぎて solutions API が消えているためなそうな。
Google の MediaPipe 側では、mediapipe 0.10.31 以降で mediapipe.solutions が削除されたと案内されており、ControlNet / controlnet_aux 側はまだその旧APIを参照している。
さらに、A1111/ControlNet まわりではこの不整合に対して、mediapipe==0.10.14 と numpy<2 に戻す回避策が実際に共有されているとのこと。

修正手順

まず、Stable Diffusion WebUI の venv を有効化する

cd /Users/StableDiffusion/stable-diffusion-webui
source venv/bin/activate

次に、壊れている関連パッケージを入れ直す。

pip uninstall -y mediapipe opencv-python opencv-python-headless opencv-contrib-python protobuf numpy
pip install "numpy<2"
pip install "protobuf>=4.21,<5" "opencv-contrib-python" "mediapipe==0.10.14"

venvを無効化してwebuiを起動する

deactivate
./webui.sh

これでやっと元通りの環境を復元することができた

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?