FollowFox blog

Windows WSL2 Installation: SD AUTOMATIC1111 WebUI and Dreambooth Extension

Learn AI


This results from 3 Windows reinstalls and many, many trials and errors. We hope that this little documentation could be helpful for you.
Please note this detailed description of an installation protocol that worked on our machine. We replicated the installation a few times (including on a separate Windows 10 machine). That said, it’s likely that on different machines and setups, there will be issues with this exact protocol. However, having such a detailed step-by-step reference point. could help discover your specific problems and deal with them
Our setup is GTX3090 on Windows 11, which was freshly installed (after failing quite a few times on non-fresh Windows).


When possible, running things locally can be preferred for a few reasons. And AI experts prefer to do it through Linux OS, which Windows users can replicate through WSL (Windows Subsystem for Linux). It’s a bit complicated to get started but helps with good habits of having virtual environments, getting used to working with Linux, and potentially improving performance or doing things that are not possible without Linux

What to expect in this write-up:

  • Setting up WSL2 on Windows 11
  • Installing the latest Nvidia Drivers
  • Installing CUDA in WSL2
  • Installing Conda in WSL2
  • Installing cudatoolkit with Conda
  • Installing git with Conda
  • Cloning AUTOMATIC1111 WebUI and Dreambooth extension repositories
  • Create a virtual environment with Conda
  • WebUI installation with detailed steps
  • Manual installation part
  • Adding ckpt file
  • Mod webui-user-dreambooth.bat and .sh files
  • Adding required path variables in WSL2
  • Installing Xformers
  • Running and testing the installation of both WebUI and Dreambooth extension
  • First launch
  • Test Image generation
  • Test Dreambooth extension

Detailed Steps

Setup WSL2

  1. Run CMD as admin
  2. Run the command: wsl --install
  3. Restart computer
  4. After restarting, we see Ubuntu is being installed
  5. It prompted us to create a username and password
  6. Once installed, I ran update commands for Ubuntu:
  • sudo apt update
  • sudo apt upgrade
7.Close the ubuntu terminal
8.Run CMD as admin
9.Run the command: wsl --update
10.Problem: it installed Ubuntu 22.04, which is a newer version and causes problems. So I’ll uninstall and install 20.04 instead
11.Uninstall by going to windows, add or remove programs, finding ubuntu, and uninstalling. Restart windows once done
12.To install a new version, I opened Microsoft store, searched for Ubuntu 20.04

13.Launch, wait for installation, and repeat from step 5

Install the latest Nvidia drivers on Windows

  1. Go to and select system details
  2. We ended up with game-ready drivers, downloaded and installed it
  3. We restarted PC as requested by the installer

Install WSL2 Cuda

We decided to use CUDA 11.6.2 as Dreambooth wanted to use 11.6, so let’s try that.
  1. Go to
  2. Select settings for wsl
  3. Run wsl by entering wsl the run. A dark prompt window appears
  4. Got to the base folder by entering: cd ~
  5. Optional: if you want to watch what’s up in that folder in windows explorer, type explorer.exe . (there is a dot after a space in that command).
  6. Run commands:
b.sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
c.wget ubuntu-11-6-local_11.6.2-1_amd64.deb
d.sudo dpkg -i cuda-repo-wsl-ubuntu-11-6-local_11.6.2-1_amd64.deb
e.sudo apt-key add /var/cuda-repo-wsl-ubuntu-11-6-local/
f.sudo apt-get update
g.sudo apt-get -y install cuda
7.After done, we restarted wsl and went to the base folder (cd ~) again.

Install Conda

  1. Inside wsl, enter: wget
  2. then enter: bash
  3. Press enter a bunch of times, enter “yes” when asked, and press enter a few more times.
  4. Restart wsl go to basre (cd ~)
  5. Update conda: conda update --all -y

Install cudatoolkit with Conda

  1. Start WSL, go to base (cd ~)
  2. Enter: conda install -c anaconda cudatoolkit
  3. It’s gonna take some time, once done restart WSL and go to base (cd ~)

Install git with Conda

  1. Start WSL, go to base (cd ~)
  2. Enter: conda install git -y

Clone Stable Diffusion automatic1111 and Dreambooth extensions

  1. Decide where to add stable diffusion repo. We used the base folder: cd ~
  2. Clone automatic1111 by entering in WSL: git clone
  3. Go to the extensions folder: cd stable-diffusion-webui/extensions/
  4. Clone dreambooth extension: git clone

Create a virtual environment with Conda

  1. Open WSL and go to the base folder (cd ~)
  2. Now go to the stable diffusion folder: cd stable-diffusion-webui
  3. Create an environment by entering: conda env create -f environment-wsl2.yaml
  4. Activate the environment by entering the following: conda activate automatic

WebUI manual installation part

  1. Start WSL and go to the base: cd ~
  2. Activate environment: conda activate automatic
  3. Go to stable diffusion location: cd stable-diffusion-webui
  4. Manually install torch and cu116 as required by dreambooth extension. Run: pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 --extra-index-url
  5. check if the torch supports GPU; this must output "True". Enter: python -c "import torch; print(torch.cuda.is_available())"
  6. Create a repositories folder by: mkdir repositories
  7. Go to the repositories folder by: cd repositories
  8. Now run these four commands to copy repositories:
a.git clone repositories/stable-diffusion
b.git clone repositories/taming-transformers
c.git clone repositories/CodeFormer
d.git clone repositories/BLIP
9.Install required packages by running commands:
a.pip install transformers==4.19.2 diffusers invisible-watermark --prefer-binary
b.pip install git+ --prefer-binary
c.pip install git+ --prefer-binary
d.pip install -r repositories/CodeFormer/requirements.txt --prefer-binary
e.pip install -U numpy --prefer-binary
10.Now go to base cd and run requirements.txt from SD and dreambooths extension installation by running: ~/stable-diffusion-webui
b.pip install -r requirements.txt --prefer-binary ~/stable-diffusion-webui/extensions/sd_dreambooth_extension
d.pip install -r requirements.txt --prefer-binary
11.Close WSl, Start WSL again, and go to: cd ~/stable-diffusion-webui
12.Activate environment: conda activate automatic

Add ckpt file

  1. Download desired ckpt model. In our case, we downloaded sd 1.5 from huggingface (registration needed)
  2. Start WSL and go to: cd ~/stable-diffusion-webui/models/Stable-diffusion
  3. Open explorer by typing explorer.exe .
  4. An Explorer window will pop up. Paste the ckpt file there

Mod webui-user-dreambooth.bat and .sh files

Unsure if required with the way I launch it but still:
  1. Start WSL and go to: cd ~/stable-diffusion-webui
  2. Open explorer by typing explorer.exe .
  3. Open webui-user-dreambooth.bat with your preferred editor. I use Visual Studio Code.
  4. Replace the text there with the code from here and save
  5. Now do the same with and replace it with the code from here:

Add path variables

We’ve been getting a lot of “WARNING! not found!” errors, and this seems to solve it:
  1. Start WSL and go to: cd ~/stable-diffusion-webui
  2. Activate environment: conda activate automatic
  3. Enter this command but replace ”irakli” with your ubuntu user name: nano /home/irakli/.bashrc
  4. A strange UI will show up, and between the lines, paste these three arguments like this
a.export CUDA_HOME=/usr/local/cuda
b.export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
c.export PATH=$PATH:$CUDA_HOME/bin
  1. After pasting arguments, press ctrl+o, then press enter, and then press ctrl+x
  2. We have already done this, but this fixed an error. Run again: conda install -c anaconda cudatoolkit

Install Xformers

  1. Start WSL and go to: cd ~/stable-diffusion-webui
  2. Activate environment: conda activate automatic
  3. Install xformers through conda: conda install xformers -c xformers/label/dev
  4. Install ninja: pip install ninja
  5. Restart wsl

Run automatic1111 for the first time

  1. Start WSL and go to: cd ~/stable-diffusion-webui
  2. Activate environment: conda activate automatic
  3. Launch webui by: python
  4. Some installations will start. Wait till it all ends and then close the WSL terminal just before the final testing steps.

Test Image generation

  1. Restart the computer before any next steps; we had issues by not doing this step before.
  2. Start WSL and go to: cd ~/stable-diffusion-webui
  3. Activate environment: conda activate automatic
  4. Launch webui by: python
  5. Go to the local link that is displayed. In my case:
  6. Generate some image to make sure it works. GG!
  7. A successful launch, in our case, looks like this:

Test Dreambooth extension

We won’t write detailed instructions on Derambooth fine-tuning here but TLDR:
  1. Go to the dreambooth tab
  2. Create model
  3. Go to train, edit settings, and launch train
  4. Make sure there are no errors, and if lucky, everything will run smoothly!
Made on