Thanks to latest billing model with Google Colab, more and more people are switching to running Stable Diffusion and other models locally on their PC. This post is covering how to setup and run Stable Diffusion locally and the installation steps have been gathered from a GitHub repository and video tutorial by Rikkar which is quite extensive but here we focus on only local execution of Stable Diffusion.

Getting Started

  1. Install Anaconda for managing python environments and packages
  2. Create a huggingface token which you will need for auto model download:
  3. Open a anaconda powershell (on Windows) or terminal (Linux). Change directory if you want to install in different location then the default eg. C:\AI
  4. Install git through anaconda: conda install -c anaconda git -y
  5. Clone the github repository:
    git clone -b local
    cd stable-diffusion
  6. Create Anaconda environment:
    conda create -n dsd python=3.9 -y
    conda activate dsd
    conda install pytorch cudatoolkit=11.6 torchvision torchaudio -c pytorch -c conda-forge -y
  7. Install required packages:
    python -m pip install -r requirements.txt
  8. Check your installation by running the .py

Running Deforum Stable Diffusion

There are four ways to run Deforum Stable Diffusion: locally with the .py file, locally with jupyter, locally through colab, and on colab severs.

Running Locally

Make sure the dsd conda environment is active:
conda activate dsd

Navigate to the stable-diffusion folder and run either the or the Deforum_Stable_Diffusion.ipynb. running the .py is the quickest and easiest way to check that your installation is working, however, it is not the best environment for tinkering with prompts and settings.

If you have already downloaded the sd-v1-4.ckpt then copy it into the stable-diffusion\models folder on your computer, otherwise the next step will ask for huggingface token each time. Save time and download the checkpoint file before hand.


Each time you run this command you will get new images generated on your computer.

Screenshot of SD running locally (Credit Rikkar)
Screenshot of resulting Images (Credit Rikkar)

You can now modify the prompts by editing the file and run the python to create new image. Prompts are defined in the prompts = [] section, which should be familiar for Google Colab users.

Tip: You should also modify line which as hash check enabled to false (at line 151 at the time of writing this post). Change check_sha256 = True to check_sha256 = False

Screenshot of prompts in file

Modify the prompts in the file. Save and run the prompt python

If you'd like to support our site please consider buying us a Ko-fi, grab a product or subscribe. Need a faster GPU, get access to fastest GPUs for less than $1 per hour with