Install Automatic1111 or Forge in Fedora using Anaconda
Written on the 3rd of May, 2024. Updated 7th of July, 2024.
Preamble
I wrote these instructions primarily for myself so that I can set things back up in case a hard-drive breaks... which totally didn't happen to me. So it's not exactly noob-friendly, but I figured there's no reason not to share it. I performed all of this in Fedora 40 but I don't see any reason you wouldn't be able to do this in any Linux-based distro, as it uses Anaconda to set up the environment which is platform independent. Most distro-specific stuff is related to your GPU drivers anyway which this guide assumes you've already got set up and running.
The reason I use conda
is that it's completely separate from the system and is the only way I got this up and running inside of Fedora (there are no Fedora-specific instructions for any AUTOMATIC1111 workflows as of writing). Fedora does offer a python3.10
package along with its libraries but I haven't figured out why it doesn't include Python3.10 versions of any static packages required for AUTOMATIC1111 to run.
Prerequisites
Nvidia GPU. This guide does not cover AMD or Intel GPUs. Ensure that the Nvidia drivers and the Nvidia CUDA drivers are installed. This will vary greatly depending on your distribution.
Install the prerequisites:
For other distros: https://github.com/AUTOMATIC1111/stable-diffusion-webui?tab=readme-ov-file#automatic-installation-on-linux (follow "Installing dependencies" step) and https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html
If trying this on a distro other than Fedora, this is where you would install Python3.10 and then create the venv or run export PYTHON=/bin/python3.10
and skip ahead to "Run the Installer". If you are on Fedora continue reading.
Setting up conda
We will use conda
to make a static, portable python environment. I'll be using a folder in ~/Applications/AUTOMATIC1111-Forge
but feel free to use whatever path you want. Create a file named environment.yaml
containing the following:
In case you messed up and need to recreate the environment, run conda env remove -n forge
and try again.
Open a terminal, cd
to the directory of environment.yaml
and then run:
Wait a while for this to complete. Then:
You'll notice that makes (forge)
appear to the left of the input line in your terminal. You are now in your conda environment for forge.
Run the installer
If you haven't already, clone the repository to your drive. git clone https://github.com/lllyasviel/stable-diffusion-webui-forge
. Replace this URL with the regular https://github.com/AUTOMATIC1111/stable-diffusion-webui
if you're installing that instead.
On June 8th, illyasviel announced he was making changes that makes existing extensions unusable with forge. If you'd like to use a fork that doesn't implement these changes, use https://github.com/Panchovix/stable-diffusion-webui-forge
If you already have your models, move them to stable-diffusion-webui/models/Stable-diffusion/
now to avoid redownloading the default one.
For AUTOMATIC1111: ./webui.sh --xformers
For Forge: ./webui.sh --cuda-stream
I you've ever launched Forge with -xformers enabled, you must use it or --disable-xformers for all future runs.
Everything should be automatically installed. This may take several hours to download and install everything. Once done, navigate to http://127.0.0.1:7860 in your web browser. Ctrl+C in your terminal to close the program, and conda deactivate
to leave the conda
environment. Or just close the terminal window.
Fix Controlnet
You'll notice if you try to use a controlnet model, it will fail. This is because insightface failed to be automatically installed. To fix this, close the webui and open a terminal in the stable-diffusion-webui
folder, then run the following:
You should have two environments active now, (venv) (forge). Run the following:
It will complain about insightface requiring pydantic
of at least >2.0.0, and you having 2.8.2. It's stupid. It installed successfully.
Set up the menu shortcut
To launch Forge from the start menu, create a file at /home/you/Applications/AUTOMATIC1111-Forge/AUTOMATIC1111-Forge.sh
that contains the following (adjusting paths as necessary):
Ensure that AUTOMATIC1111-Forge.sh
is set as executable.
Create the desktop file to launch the program. I use KDE's Menu editor to create a shortcut with the following fields, though the only required field is the work path being set to where webui.sh
is /home/you/Applications/AUTOMATIC1111-Forge/stable-diffusion-webui-forge/
. Everything else left to its default/blank.
Name: AUTOMATIC1111 Forge
Description: SD Model WebUI
Comment: An extensible webUI for image generation and altering with Stable Diffusion. Forge is a fork with improved memory management and speed.
Program: /home/you/Applications/AUTOMATIC1111-Forge/AUTOMATIC1111-Forge.sh
Work path: /home/you/Applications/AUTOMATIC1111-Forge/stable-diffusion-webui-forge/
Run in terminal: Checked