How to Install Stable Diffusion on Windows: A Comprehensive Guide

February 26, 2025
How to Install Stable Diffusion on Windows: A Comprehensive Guide
Unlock your creativity on Windows by learning how to install and use Stable Diffusion for stunning AI-generated images. Follow this detailed guide for a seamless installation process.

1. Introduction

The digital landscape has been revolutionized by the advent of artificial intelligence, particularly in the realm of image generation. Stable Diffusion stands out as an innovative tool, allowing users to convert textual descriptions into stunning visuals. This guide aims to lead you through the process of installing and utilizing Stable Diffusion on your Windows PC. With the right hardware and software prerequisites, you can unlock a world of creativity, generating images that are not only captivating but also fully owned by you, thanks to its free and open-source nature.

2. Preparing Your PC for Stable Diffusion

Before diving into the installation, it is essential to verify that your PC meets the necessary requirements to run Stable Diffusion efficiently. Here are the specifications you should check:

  • Dedicated Graphics Card: An NVIDIA GPU is highly recommended for optimal performance.
  • GPU Memory: Ensure that your dedicated GPU memory is at least 4 GB.
  • Hard Drive Space: A minimum of 10 GB of free hard drive space is necessary to accommodate the software and models.

To check your GPU status on Windows, press Control + Shift + Escape to open the Task Manager and navigate to the Performance tab. If your PC fulfills these criteria, you are ready to proceed with the installation.

3. Installing Pre-Requisites: Git and Python

Successful installation of Stable Diffusion hinges on two critical software prerequisites: Git and Python. Follow these steps to get them installed:

  1. Download Git: Visit the official Git website and download the installation file. Run the installer with default settings to complete the installation.

Git is used for source control management, but in this case, we're simply using it to download Stable Diffusion and keep it up to date.

  1. Download Python: Go to the Python website and ensure you select version 10.6, which is compatible with Stable Diffusion. During the installation, make sure to check the box that adds python.exe to the system's PATH, facilitating easy access to Python from the command line.

During the installation process, check the box to add python.exe to the system's PATH, which will make it easier to run the Python scripts.

4. Installing Stable Diffusion with WebUI

With the prerequisites in place, we can now proceed to install Stable Diffusion itself. The recommended method is to use a popular fork called WebUI, which provides a user-friendly graphical interface. Here’s how to install it:

  • Open File Explorer: Press Windows key + E and navigate to a location for your installation.

  • Create a Folder: Name it "stable-diffusion".

  • Open Command Prompt: In the folder, click the address bar, type CMD, and hit Enter.

  • Clone the Repository: Enter the command git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui and press Enter. This command downloads the Stable Diffusion files from the official GitHub repository.

5. Downloading the Stable Diffusion Base Model

After downloading the core files, the next step involves acquiring the Stable Diffusion Base Model. Follow these instructions:

  • Locate and download the base model file named (v1-5-pruned-emaonly.ckpt):

  • Put the downloaded file in the following folder:

    This model plays a crucial role in facilitating image generation functions within the Stable Diffusion application. However, I suggest exploring platforms such as Civit AI for more sophisticated models and checkpoints. Models can be downloaded from these sites and should be placed in the same directory mentioned earlier.

6. Launching the Stable Diffusion Web UI

To start using Stable Diffusion, it is vital to launch the Web UI effectively:

  • Navigate to the stable-diffusion-webui folder.
  • Double-click on the web-user.bat file. This action opens a command prompt window, initiating the installation of necessary packages for Stable Diffusion.
  • Once the installation completes, a local link will be displayed in the command prompt. Use Ctrl + C to copy this link, then paste it into your preferred web browser.
  • Congratulations! You have officially installed Stable Diffusion, and you can now start generating images by entering input prompts.

- At the top left corner, you have the option to choose your base model, create your input prompt, and begin generating AI images.

7. Additional Settings

By default, your version of Stable Diffusion will not receive automatic updates. Considering the rapid pace of advancements, it is highly probable that you will need to update your version at some stage in order to access the most up-to-date and impressive features. This can be achieved by adding the line git pull to the top of the webui-user.bat file.

Additionally you can speed up stable diffusion with some additional settings. If you have less than 8 GB VRAM on GPU, it is a good idea to turn on the --medvram option to save memory to generate more images at a time.

To enable these settings, right-click on the file webui-user.bat and select Edit. (You may need to select “Show More Options” first if you use Windows 11).

  • When opened add git pull to the top of the document. This will automatically update to the newest version when starting Stable Diffusion.
  • Update COMMANDLINE_ARGS to the following: set COMMANDLINE_ARGS= --xformers --medvram
  • Save, Close and Double Click the file to start Stable Diffusion with these new settings.

Do you get out-of-memory errors?

  • Consider changing the --medvram settings to --lowvram.
  • Additionally, Add a new line in the webui-user.bat file named set PYTORCH_CUDA_ALLOC_CONF.
  • Set the value to garbage_collection_threshold:0.6,max_split_size_mb:128

8. Conclusion

In this guide, we explored the comprehensive installation and usage of Stable Diffusion on Windows, a powerful tool for image generation through AI. By following the outlined steps, users can set up Stable Diffusion on their PCs, harnessing the ability to create stunning images based on text prompts. Moreover, with an understanding of further settings, users can enhance their experience, ensuring that they remain at the forefront of advancements in AI-assisted creativity. Embrace this tool and have fun exploring the endless creative possibilities it offers!

Frequently Asked Questions

AI Image Generation

Create Amazing AI Images

Generate stunning artwork with our powerful AI image generation tool

OR