stable diffusion local install

1.Install Conda Environment

Before installation, you need to download and install miniconda. Miniconda is a lightweight conda distribution that can quickly install and manage conda environments.

Download link: https://docs.conda.io/en/latest/miniconda.html

For example, after installing windows, open a command prompt window and enter the following command to create a python 3.10.6 environment named sd_3106:

conda create -p D:\ProgramData\miniconda3\envs\sd_3106 python=3.10.6

2.Clone Code

Open the command prompt and enter the following command to clone the code: Of course, if you don’t have a Git environment locally, please download and install Git first: https://git-scm.com/download/win

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

3.Set Pip Mirror Source Due to the slow access to pypi in China, we can set the pip mirror source to speed up the download.

Enter the following command to set the pip mirror source to Aliyun:

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

4.Upgrade Pip Enter the following command to upgrade pip:

D:\ProgramData\miniconda3\envs\sd_3106\Scripts\python.exe -m pip install --upgrade pip

5.GPU Environment Check The Stable Diffusion recommended GPU operating environment is NVIDIA GPU, of course, AMD GPU is also possible but not recommended (AMD GPU installation)

wmic path win32_VideoController get name

If the output contains the keyword: AMD Radeon, it means that your graphics card is an AMD architecture. At this time, please follow the above link to install. If the output keyword is NVIDIA GeForce, it means that your graphics card is an NVIDIA GPU. At this time, you need to download another thing called CUDA (CUDA is a universal parallel computing architecture launched by NVIDIA).

6.Download Cuda There is a corresponding relationship between NVIDIA GPU architecture and cuda, which can be found online.

cuda download address: https://developer.nvidia.com/cuda-downloads

7.Run Webui Enter the following command to start stable diffusion webui:

Because many of the things downloaded in the middle are downloaded from Github, the download speed is very slow in China, so you need to go online by yourself

# windows
webui-user.bat
# linux 
webui-user.sh

8.Error Guide

( in China ) If an error occurs when running the script, it is most likely due to a network problem that caused the download to fail Open stable-diffusion-webui/launch.py and find prepare_environment(), you can see several links of https://github.com, add https://ghproxy.com/ before them.

After adding, it looks like: https://ghproxy.com/https://github.com/..... Then save and continue to execute the script.