1 min read

Setup ComfyUI on Ubuntu 24.04 LTS with an AMD GPU

Setup ComfyUI on Ubuntu 24.04 LTS with an AMD GPU
AI Robot

As stated on comfy.org ComfyUI is the most powerful open source node-based application for generative AI. In this article I explain how to install this tool and generate AI images with ComfyUI on Ubuntu 24.04 LTS and an AMD GPU.

Before continuing to the installation, make sure to create a virtual environment by following these steps.

Installation

After following the preperations, run the following command in a terminal:

cd ~
git clone https://github.com/comfyanonymous/ComfyUI

After creating a virtual environment, you can copy the virtual environment into the git repository:

cd ComfyUI
cp -a ../ai-venv/venv .

Now activate the venv:

source venv/bin/activate

Then install the other Python packages:

pip install -r requirements.txt

Check the GFX version of your AMD GPU:

rocminfo | grep "\-gfx"

The output will be something like this:

Name:                    amdgcn-amd-amdhsa--gfx1101

Now use the last 4 numbers divided by the dots to use the right version as HSA_OVERRIDE_GFX_VERSION, for example in my case:

HSA_OVERRIDE_GFX_VERSION=11.0.1; python main.py --listen

If you do not want ComfyUI to run public, only on localhost, you can remove the --listen tag. Stable Diffusion will be available in the browser:

http://localhost:8188

Checkpoints location

The checkpoints can be downloaded and stored in the directory of ComfyUI in ./models/checkpoints/.

Download checkpoints of Stable Diffusion 1.5 to test if ComfyUI works as expected:

https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors

More information about this model can be found at:

https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/tree/main

Running the application

The installation steps above are only necessary the first time before running the AI tool, once the virtual environment is configuered and installed, you can just use the following commands to get everything up and running.
Open a terminal by hitting the windows button, type 'cmd' and hit enter:

cd ~/ComfyUI
source venv/bin/activate
HSA_OVERRIDE_GFX_VERSION=11.0.1; python main.py --listen