Install Comfyui on Linux

How to Install ComfyUI on Linux

ComfyUI is a powerful and modular GUI and backend for stable diffusion models, featuring a graph/node-based interface that allows you to design and execute advanced stable diffusion workflows without any coding. Here are the steps to install ComfyUI on a Linux system:

1. Clone the Repository

Start by cloning the ComfyUI repository to your local machine. Open a terminal and run the following command:

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

2. Place Model Files

Place your Stable Diffusion checkpoints (the large ckpt/safetensors files) into the models/checkpoints directory.

3. Install PyTorch

Install PyTorch based on your GPU type. For AMD GPUs, use the following commands to install the stable or nightly version of PyTorch:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.0
# or
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.1

For NVIDIA GPUs, use the following command:

pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
# or
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124

4. Install Dependencies

Navigate to the ComfyUI directory in your terminal and run the following command to install all required dependencies:

pip install -r requirements.txt

5. Run ComfyUI

Finally, run the following command to start ComfyUI:

python main.py

That's it! ComfyUI should now be running on your Linux system. You can start designing and executing advanced stable diffusion workflows using the graph/node-based interface.

6. AMD GPU Users Note

If you are using an AMD GPU that is not officially supported by ROCm, you may need to set an environment variable to override the GPU version:

HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py
# or for RDNA3 cards like the 7600:
HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.py

7. Intel GPU Users

If you are using an Intel GPU, you will need to follow the installation instructions for Intel's Extension for PyTorch (IPEX), which includes installing the necessary drivers, Basekit, and IPEX packages, and then running ComfyUI as described for Windows and Linux.

8. Mac Silicon Users

For users with Apple M1 or M2 chips, install the latest nightly version of PyTorch and follow the manual installation instructions for Windows and Linux.

Troubleshooting

If you encounter any issues during installation, refer to the official ComfyUI documentation (opens in a new tab) or community forums for assistance.