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:

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:

git clone

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

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:

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
# linux

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/ and find prepare_environment(), you can see several links of, add before them.

After adding, it looks like: Then save and continue to execute the script.