LoginSignup
1
1

AUTOMATIC1111インストール

Last updated at Posted at 2023-10-30

環境

  • PC:Mouse DAIV-4N-KK
  • CPU:Intel Core i7-10510U
  • GPU:NVIDIA GeForce MX250 + Intel UHD Graphics 620
  • MEM:32.0 GB
  • OS:Windows 11 Pro 22H2

必要なもの

  • Python 3.10
  • Git 最新
  • 100GB程度のHDD/SSD空き容量

インストール方法

1. Python 3.10系 をインストールする。

執筆時点でPythonの最新版は 3.12.0 になっているが、AUTOMATIC1111を使うにはPython 3.10系じゃないとだめっぽいので3.10系をインストールする。
執筆時点でMSIインストラーでインストールできるのPython3.10.xの最新版は 3.10.11 でした。

すでにPython3.10以外のバージョンが入っていても、インストールパスを変えれば複数のバージョンがインストールできる。

また、複数のバージョンがインストールされていても py コマンドでバージョンを指定して実行すればバージョンを切り替えることができるので、既存のPythonを削除する必要はない。

PS C:\>
PS C:\> py --list
 -V:3.12 *        Python 3.12 (64-bit)
 -V:3.11          Python 3.11 (64-bit)
 -V:3.10          Python 3.10 (64-bit)
PS C:\>
PS C:\> py -3.12 --version
Python 3.12.0
PS C:\>
PS C:\> py -3.11 --version
Python 3.11.6
PS C:\>
PS C:\> py -3.10 --version
Python 3.10.11
PS C:\>

2. Gitの最新版をインストールする。

git for windows
https://gitforwindows.org/

3. AUTOMATIC1111をインストールするディレクトリを作成する。

このでは C:\StableDiffusion とします。

PS C:\> 
PS C:\> md C:\StableDiffusion
PS C:\> 
PS C:\> cd C:\StableDiffusion
PS C:\StableDiffusion>
PS C:\StableDiffusion>

4. git pull で最新版をダウンロードする。

PS C:\StableDiffusion>
PS C:\StableDiffusion> git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
PS C:\StableDiffusion>
PS C:\StableDiffusion> dir


    ディレクトリ: C:\StableDiffusion


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2023/10/30     12:13                stable-diffusion-webui


PS C:\StableDiffusion>

5. Pythonで仮想環境を作成する

ダウンロードした stable-diffusion-webui ディレクトリに移動してPythonの仮想環境を作成する。

PS C:\StableDiffusion>
PS C:\StableDiffusion> cd stable-diffusion-webui
PS C:\StableDiffusion\stable-diffusion-webui>
PS C:\StableDiffusion\stable-diffusion-webui> python -m venv venv
PS C:\StableDiffusion\stable-diffusion-webui>

複数のPythonバージョンをインストールしているときは、Python3.10 を指定して仮想環境を作る。

PS C:\StableDiffusion>
PS C:\StableDiffusion> cd stable-diffusion-webui
PS C:\StableDiffusion\stable-diffusion-webui>
PS C:\StableDiffusion\stable-diffusion-webui> py -3.10 -m venv venv
PS C:\StableDiffusion\stable-diffusion-webui>

6. Pythonで仮想環境に入ってパッケージを確認

.\venv\Scripts\activate というコマンドを実行し作成した仮想環境に切り替える。
プロンプトに (venv) が付加されればOK。
仮想環境で python や pip というパッケージ管理の動作を確認する。

PS C:\StableDiffusion\stable-diffusion-webui>
PS C:\StableDiffusion\stable-diffusion-webui> .\venv\Scripts\activate
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui> python --version
Python 3.10.11
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui> pip list
Package    Version
---------- -------
pip        23.0.1
setuptools 65.5.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\StableDiffusion\stable-diffusion-webui>

「pipの最新版があるよ」風なメッセージが出るので、お好みでアップデートしておく。

(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui> python.exe -m pip install --upgrade pip
(venv) PS C:\StableDiffusion\stable-diffusion-webui> python.exe -m pip install --upgrade setuptools
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui> pip list
Package    Version
---------- -------
pip        23.3.1
setuptools 68.2.2
(venv) PS C:\StableDiffusion\stable-diffusion-webui>

仮想環境から抜け出すには deactivate コマンドを実行する。

(venv) PS C:\StableDiffusion\stable-diffusion-webui> deactivate
PS C:\StableDiffusion\stable-diffusion-webui>
PS C:\StableDiffusion\stable-diffusion-webui>

7. webui-user.bat を実行してエラーに対処する

webui-user.bat を実行して以下のようなエラーが出たので webui-user.batCOMMANDLINE_ARGS--skip-torch-cuda-test オプションを追加

RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

webui-user.bat を実行して以下エラーが出たので webui-user.batCOMMANDLINE_ARGS--no-half オプションを追加

 
RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'
 
RuntimeError: "addmm_impl_cpu_" not implemented for 'Half'
 
webui-user.bat
@echo off

set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--skip-torch-cuda-test --no-half

call webui.bat

webui-user.bat を実行しブラウザが立ち上がって画面が出ればOK。
画面が出なかったらブラウザから http://127.0.0.1:7860/ にアクセスしてみる。
image.png

おまけ

webui-user.bat を実行すると自動的にPythonのパッケージがインストールされる。
インストールされたパッケージは仮想環境に入ってから pip list コマンドで確認できる

PS C:\> 
PS C:\> cd C:\StableDiffusion\stable-diffusion-webui
PS C:\StableDiffusion\stable-diffusion-webui>
PS C:\StableDiffusion\stable-diffusion-webui> .\venv\Scripts\activate
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
(venv) PS C:\StableDiffusion\stable-diffusion-webui> pip list
Package                   Version
------------------------- ---------------
absl-py                   2.0.0
accelerate                0.21.0
addict                    2.4.0
aenum                     3.1.15
aiofiles                  23.2.1
aiohttp                   3.8.6
aiosignal                 1.3.1
altair                    5.1.2
antlr4-python3-runtime    4.9.3
anyio                     3.7.1
async-timeout             4.0.3
attrs                     23.1.0
basicsr                   1.4.2
beautifulsoup4            4.12.2
blendmodes                2022
boltons                   23.0.0
cachetools                5.3.2
certifi                   2023.7.22
charset-normalizer        3.3.1
clean-fid                 0.1.35
click                     8.1.7
clip                      1.0
colorama                  0.4.6
contourpy                 1.1.1
cycler                    0.12.1
deprecation               2.1.0
einops                    0.4.1
exceptiongroup            1.1.3
facexlib                  0.3.0
fastapi                   0.94.0
ffmpy                     0.3.1
filelock                  3.13.0
filterpy                  1.4.5
fonttools                 4.43.1
frozenlist                1.4.0
fsspec                    2023.10.0
ftfy                      6.1.1
future                    0.18.3
gdown                     4.7.1
gfpgan                    1.3.8
gitdb                     4.0.11
GitPython                 3.1.32
google-auth               2.23.3
google-auth-oauthlib      1.1.0
gradio                    3.41.2
gradio_client             0.5.0
grpcio                    1.59.0
h11                       0.12.0
httpcore                  0.15.0
httpx                     0.24.1
huggingface-hub           0.18.0
idna                      3.4
imageio                   2.31.6
importlib-metadata        6.8.0
importlib-resources       6.1.0
inflection                0.5.1
Jinja2                    3.1.2
jsonmerge                 1.8.0
jsonschema                4.19.1
jsonschema-specifications 2023.7.1
kiwisolver                1.4.5
kornia                    0.6.7
lark                      1.1.2
lazy_loader               0.3
lightning-utilities       0.9.0
llvmlite                  0.41.1
lmdb                      1.4.1
lpips                     0.1.4
Markdown                  3.5
MarkupSafe                2.1.3
matplotlib                3.8.0
mpmath                    1.3.0
multidict                 6.0.4
networkx                  3.2.1
numba                     0.58.1
numpy                     1.23.5
oauthlib                  3.2.2
omegaconf                 2.2.3
open-clip-torch           2.20.0
opencv-python             4.8.1.78
orjson                    3.9.10
packaging                 23.2
pandas                    2.1.2
piexif                    1.1.3
Pillow                    9.5.0
pip                       23.3.1
platformdirs              3.11.0
protobuf                  3.20.0
psutil                    5.9.5
pyasn1                    0.5.0
pyasn1-modules            0.3.0
pydantic                  1.10.13
pydub                     0.25.1
pyparsing                 3.1.1
PySocks                   1.7.1
python-dateutil           2.8.2
python-multipart          0.0.6
pytorch-lightning         1.9.4
pytz                      2023.3.post1
PyWavelets                1.4.1
PyYAML                    6.0.1
realesrgan                0.3.0
referencing               0.30.2
regex                     2023.10.3
requests                  2.31.0
requests-oauthlib         1.3.1
resize-right              0.0.2
rpds-py                   0.10.6
rsa                       4.9
safetensors               0.3.1
scikit-image              0.21.0
scipy                     1.11.3
semantic-version          2.10.0
sentencepiece             0.1.99
setuptools                68.2.2
six                       1.16.0
smmap                     5.0.1
sniffio                   1.3.0
soupsieve                 2.5
starlette                 0.26.1
sympy                     1.12
tb-nightly                2.16.0a20231029
tensorboard-data-server   0.7.2
tifffile                  2023.9.26
timm                      0.9.2
tokenizers                0.13.3
tomesd                    0.1.3
tomli                     2.0.1
toolz                     0.12.0
torch                     2.0.1+cu118
torchdiffeq               0.2.3
torchmetrics              1.2.0
torchsde                  0.2.5
torchvision               0.15.2+cu118
tqdm                      4.66.1
trampoline                0.1.2
transformers              4.30.2
typing_extensions         4.8.0
tzdata                    2023.3
urllib3                   2.0.7
uvicorn                   0.23.2
wcwidth                   0.2.8
websockets                11.0.3
Werkzeug                  3.0.1
yapf                      0.40.2
yarl                      1.9.2
zipp                      3.17.0
(venv) PS C:\StableDiffusion\stable-diffusion-webui>
1
1
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
1