Tech Explorer Logo

Search Content

How to Install Stable Diffusion Locally - Complete Guide

2 min read
Cover image for How to Install Stable Diffusion Locally - Complete Guide

Setting Up the Conda Environment

Before installation, you’ll need to download and install miniconda, a lightweight distribution of conda that allows for quick installation and management of Python environments.

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

After installing on Windows, open a command prompt and create a Python 3.10.6 environment named sd_3106 using the following command:

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

Cloning the Repository

First, ensure you have Git installed on your system. If not, download it from: https://git-scm.com/download/win

Then, clone the repository using:

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

Configuring PIP

To optimize download speeds, especially if you’re experiencing slow connections to PyPI, configure pip to use a faster mirror. For example, to use the Aliyun mirror:

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

Upgrading PIP

Ensure you have the latest version of pip:

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

GPU Requirements

Stable Diffusion works best with NVIDIA GPUs, though AMD GPUs are also supported (see AMD GPU installation guide).

To check your GPU:

   wmic path win32_VideoController get name

If the output shows “AMD Radeon”, follow the AMD installation guide linked above. For “NVIDIA GeForce” GPUs, you’ll need to install CUDA, NVIDIA’s parallel computing platform.

Installing CUDA

Different NVIDIA GPU architectures require specific CUDA versions. Check the compatibility matrix for your GPU model.

Download CUDA here: https://developer.nvidia.com/cuda-downloads

Running the WebUI

Launch Stable Diffusion WebUI using:

   # For Windows
webui-user.bat
# For Linux 
webui-user.sh

Note: Many components are downloaded from GitHub, which might be slow in certain regions. Consider using a VPN if needed.

Troubleshooting

If you encounter download errors, they’re likely due to network issues. You can modify the GitHub URLs in stable-diffusion-webui/launch.py by adding https://ghproxy.com/ before each GitHub URL.

For example, change: https://github.com/... to https://ghproxy.com/https://github.com/...

Save the file and run the script again to continue the installation.

Share