Saturday | 20 APR 2024
[ previous ]
[ next ]

(Failed) - Notes on Installing Stable Diffusion on WSL2 Ubuntu

Date: 2022-08-31

These steps go nowhere :)

This will be just the steps to install stable diffusion on my Windows Subsystem for Linux Ubuntu.

This link is what I'm working off of.

The first step is to install miniconda, you could do anaconda as well.

$ wget
$ bash

Conda seems to have been screwed up and I had to restart wsl to get it to properly run the create command.

$ wsl.exe --shutdown

Open WSL again.

The next step is to get the stable diffusion code.

$ git clone

Now that we have the code, we need to get the weights. This requires an account with hugging face and you need to accept their license.

This will then give you a link to download the weights. The filename will be sd-v1-4.ckpt.

Once this file is downloaded, place the file inside the stable-diffusion git folder.

$ cd stable-diffusion
$ explorer.exe .

Now we can create the environment needed using conda.

$ conda env create -f environment.yaml
$ conda activate ldm

Finally we can try out the new AI.

$ python scripts/ --prompt "YOUR-PROMPT-HERE" --plms --ckpt sd-v1-4.ckpt --skip_grid --n_samples 1

I did this raw and I'm curious what I'll see with just your-prompt-here.

I might need to install and set up CUDA to be able to use my GPU but I gave it a shot before.

After waiting for quite some time while it downloaded, I got an error.

RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from

Going to guess its the CUDA stuff but shot in the dark.

$ sudo apt-key del 7fa2af80
$ wget
$ sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
$ sudo apt-key adv --fetch-keys
$ sudo add-apt-repository "deb /"
$ sudo apt-get update
$ sudo apt-get -y install cuda

To test if WSL2 is able to use it.

$ git clone
$ cd cuda-samples/Samples/1_Utilities/deviceQuery
$ make
$ ./deviceQuery

This ultimately didn't work. I got an error message that the Cuda version was out of sync. I have a 3060 Ti which seems to use cuda 8.6 while Ubuntu has the package at version 11.7.1. I'm not entire sure if those numbers are telling me what I think they are telling me.

Going to install the CUDA toolkit 11.7 and see if that helps.

Installed this and this looks good. I uninstalled cuda.

$ sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*" 

Then re-installing it.

$ sudo apt-get install cuda

I'm going to try re-doing the steps but this time using instructions from reddit. Didn't work.

Another set of instructions to try

Get the Linux run file and make sure to not install the driver, only the libraries.

$ wget
$ sudo sh

Make sure to not install the driver. This will also update the /usr/local/cuda to be a symlink to the one we are installing.

Doesn't work.