1
3

More than 1 year has passed since last update.

Stable Diffusion Web UIの実行で発生したエラーとその解決方法

Last updated at Posted at 2023-07-20

皆さんこんにちは。今回は、私がStable Diffusion Web UIを初めて実行しようとした際に発生したエラーと、その解決方法についてお話ししたいと思います。

※エラー解決が主な目的なのでインストール方法を詳しくみたい方は参考サイトを読んでください。

参考にしたサイト
Stable Diffusion Web UIのインストール(動画)
Stable Diffusion Web UIのインストール(メモ)
pyenvを使ったPythonのバージョン切り替え

エラーの発生

初めに、以下の手順に従ってStable Diffusion Web UIを設定しようとしました:

  1. Homebrewをインストール
  2. 必要な依存関係をインストール
brew install cmake protobuf rust python@3.10 git wget

3. Stable Diffusion web UIをクローン

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui

4. 学習済みモデルを下記のパスに格納

stable-diffusion-webui/models/Stable-diffusion

5. ディレクトリの移動、Stable Diffusion Web UIを起動

cd stable-diffusion-webui
./webui.sh

しかしながら、以下のエラーが出てしまいました:

 note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for gfpgan
ERROR: Could not build wheels for gfpgan, which is required to install pyproject.toml-based projects

エラーメッセージによると、gfpgan のインストールがうまく行かないようです。

エラーの解決

エラーの解決方法として、Pythonのバージョンを3.10.4から3.10.6に変更しました。以下に、Pythonのバージョンをアップグレードするためのコマンドを示します:

pyenv install 3.10.6
pyenv global 3.10.6

その後、pythonのバージョンを確認して

python -V
Python 3.10.6

Pythonのバージョンが正しく変更されたことが確認できました。しかし、再度 ./webui.sh を実行したところ、バージョンが変更されていませんでした:

Python 3.10.4 (main, Jun  6 2022, 21:10:44) [Clang 13.1.6 (clang-1316.0.21.2.5)]

実行スクリプトが新しく設定したPythonバージョンを認識していないため、エラーが発生しています。以下のコマンドを使用してPython仮想環境を削除しました:

Python仮想環境を削除

rm -rf venv

その後、再度 ./webui.sh を実行したところ、無事に gfpgan がインストールされ、Stable Diffusion Web UIが正常に動作しました。

このエラーの原因は、Pythonのバージョン3.10.4と gfpgan の互換性の問題であったと考えられます。したがって、Pythonのバージョンを3.10.6にアップグレードすることで、この問題を解決することができました。

pyenvを使うことでPythonのパッチバージョンも簡単に変更できます。

それでは、皆さんも無事にStable Diffusion Web UIの設定を行うことができることを願っています。何か問題が発生した場合は、お気軽にコメントください。

1
3
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
1
3