Alibaba Cloud PAI Releases Z-Image-Turbo-Fun-Controlnet-Union - Multi-Condition ControlNet Model
12/02/2025
How to Install ComfyUI on Linux
⚠️ Important Notice: This documentation may not always be up-to-date. Please refer to the ComfyUI Official Repository first for the latest and most accurate installation instructions, especially for specific configurations such as AMD GPU support. The official documentation is the best source for the most current information.
There are two main ways to install ComfyUI on Linux:
- Install using Comfy CLI (Recommended) - The simplest and fastest method
- Install from ComfyUI source code - Traditional manual installation method
This tutorial will cover both installation methods in detail, with a focus on recommending Comfy CLI installation.
Method 1: Install ComfyUI using Comfy CLI (Recommended)
Comfy CLI is the official command-line tool provided by ComfyUI, which greatly simplifies the ComfyUI installation and management process.
Step 1: System Environment Preparation
1. Ensure Python Environment
ComfyUI requires Python 3.12 or higher (Python 3.13 is recommended). Check your Python version:
python3 --version If Python is not installed or the version is too low, install it following these steps:
Ubuntu/Debian systems:
sudo apt update
sudo apt install python3 python3-pip python3-venvCentOS/RHEL/Fedora systems:
# CentOS/RHEL
sudo yum install python3 python3-pip
# Or Fedora
sudo dnf install python3 python3-pipArch Linux:
sudo pacman -S python python-pip2. Install Git (if not installed)
# Ubuntu/Debian
sudo apt install git
# CentOS/RHEL
sudo yum install git
# Fedora
sudo dnf install git
# Arch Linux
sudo pacman -S git3. Create Virtual Environment (Recommended)
Using a virtual environment can avoid package conflict issues:
# Create a virtual environment named comfy-env
python3 -m venv comfy-env
# Activate the virtual environment
source comfy-env/bin/activateNote: You need to activate the virtual environment each time before using ComfyUI. To exit the virtual environment, use the
deactivatecommand.
Step 2: Install Comfy CLI
Install comfy-cli in the activated virtual environment:
pip install comfy-cliConfigure Command Line Auto-completion (Optional)
To get a better user experience, you can enable command line auto-completion:
comfy --install-completionStep 3: Install ComfyUI
Installing ComfyUI with comfy-cli is very simple, requiring just one command:
comfy installThis command will:
- Download and install the latest version of ComfyUI
- Automatically install ComfyUI-Manager (node manager)
- Configure basic project structure
Installation Options
You can use the following options to customize the installation:
# Install to default location ~/comfy
comfy install
# Install to specified directory
comfy --workspace=/path/to/your/workspace install
# Operate on existing ComfyUI in current directory (mainly for updates)
comfy --here install
# Operate on most recently executed or installed ComfyUI
comfy --recent install
# Install only ComfyUI, without ComfyUI-Manager
comfy install --skip-managerCheck Installation Path
You can use the following commands to check the current workspace:
# Check default workspace
comfy which
# Check workspace for specified options
comfy --recent which
comfy --here whichStep 4: Install GPU Support
NVIDIA GPU (CUDA)
If you’re using an NVIDIA GPU, you need to install CUDA support:
# Install PyTorch with CUDA support
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130Note: Please choose the corresponding PyTorch version based on your CUDA version. Visit the PyTorch website for the latest installation commands.
AMD GPU (ROCm)
If you’re using an AMD GPU, you need to install the ROCm version of PyTorch:
# Install PyTorch with ROCm support
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.4Note: For the latest ROCm installation commands, visit the PyTorch website.
For AMD GPUs Not Officially Supported by ROCm
If your AMD GPU is not officially supported by ROCm (such as RX 6700, RX 6600, RX 7600, etc.), you can use environment variables to force enable support:
For RDNA2 architecture GPUs (such as RX 6700, RX 6600, etc.):
HSA_OVERRIDE_GFX_VERSION=10.3.0 comfy launchFor RDNA3 architecture GPUs (such as RX 7600, etc.):
HSA_OVERRIDE_GFX_VERSION=11.0.0 comfy launchIf using the source code installation method, use:
# RDNA2 GPUs
HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py
# RDNA3 GPUs
HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.pyAMD GPU Performance Optimization Tips
On newer PyTorch versions, you can try enabling experimental memory-efficient attention to improve performance (enabled by default on RDNA3 GPUs):
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 comfy launch -- --use-pytorch-cross-attentionYou can also try setting the following environment variable, which may improve speed (but the first run will be slower):
PYTORCH_TUNABLEOP_ENABLED=1 comfy launchIntel GPU
If you’re using an Intel GPU:
# Install PyTorch with Intel XPU support
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/xpuCPU Only
If running with CPU only:
# Install CPU version of PyTorch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpuStep 5: Launch ComfyUI
After installation is complete, launch ComfyUI:
comfy launchBy default, ComfyUI will run on http://localhost:8188.
Common Launch Options
# Specify listen address and port
comfy launch -- --listen 0.0.0.0 --port 8080
# Use CPU mode
comfy launch -- --cpu
# Low VRAM mode
comfy launch -- --lowvram
# Ultra-low VRAM mode
comfy launch -- --novramNote: The
--backgroundparameter may no longer be supported in some versions of ComfyUI. If you need to run in the background, consider using system-level tools such asnohuporscreen.
Method 2: Install from ComfyUI Source Code
If you prefer the traditional installation method, you can also install directly from source code:
1. Clone ComfyUI Repository
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI2. Create Virtual Environment
python3 -m venv venv
source venv/bin/activate3. Install Dependencies
pip install -r requirements.txt4. Install GPU Support
Install the corresponding PyTorch version based on your GPU type (refer to the steps above).
5. Launch ComfyUI
python main.pyIf you’re using an AMD GPU and encounter issues, please refer to the AMD GPU troubleshooting section below.
Post-Installation Configuration
Install Base Models
ComfyUI requires base models to function properly. You can:
- Download models from Hugging Face
- Place model files in the
models/checkpoints/directory - Download using comfy-cli:
comfy model download --url https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors --relative-path models/checkpointsTroubleshooting
Common Issues
1. Permission Issues
If you encounter permission issues, ensure you have sufficient permissions to write to the installation directory:
# If using default directory, ensure ~/comfy directory is writable
ls -la ~/comfy2. Python Version Issues
Ensure you’re using the correct Python version:
python3 --version # Should be 3.12 or higher3. Network Connection Issues
If downloads are slow, try using a domestic mirror:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple comfy-cli4. Package Build Errors (Fedora/RHEL)
If you encounter sentencepiece build errors on Fedora systems:
# Install development packages
sudo dnf install sentencepiece-devel gcc-c++ cmake5. Alternative Package Managers
If you encounter persistent dependency issues, consider using alternative package managers:
Using Miniconda (Recommended for complex environments):
# Download and install Miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
# Create conda environment
conda create -n comfyui python=3.12
conda activate comfyui
# Install ComfyUI
pip install comfy-cli
comfy install6. GPU Detection Issues
Check if GPU is properly recognized:
import torch
print(torch.cuda.is_available()) # NVIDIA GPU
print(torch.version.cuda) # CUDA version7. Path and Navigation Issues
If you encounter directory navigation errors:
# Always use absolute paths or ensure you're in the correct directory
pwd # Check current directory
ls -la # List files in current directory
# Create directories if they don't exist
mkdir -p ~/comfyui-workspace
cd ~/comfyui-workspace8. AMD GPU Issues
Issue: Error message about NVIDIA driver not found when starting
Cause: Even after installing the ROCm version of PyTorch, if the system detects NVIDIA drivers or incorrect configuration, this error may still occur.
Solutions:
-
Verify you have installed the correct ROCm version of PyTorch:
python -c "import torch; print(torch.__version__)" -
Check if you’re in a virtual environment:
# Make sure the virtual environment is activated source comfy-env/bin/activate # or your virtual environment path -
For non-officially supported AMD GPUs, use environment variables:
# RDNA2 GPUs HSA_OVERRIDE_GFX_VERSION=10.3.0 python main.py # RDNA3 GPUs HSA_OVERRIDE_GFX_VERSION=11.0.0 python main.py -
If the problem persists, try starting in CPU mode:
python main.py --cpu -
Refer to official documentation: For more AMD GPU information, please refer to the ComfyUI official repository’s AMD GPU section.
6. Virtual Environment Path Issues
Issue: Cannot find virtual environment path after closing ComfyUI
Solutions:
-
Remember the full path of the virtual environment:
# When creating a virtual environment, use an absolute path or remember the relative path cd ~/your-workspace python3 -m venv comfy-env -
Activate the virtual environment before each use:
# Navigate to the virtual environment directory cd ~/your-workspace source comfy-env/bin/activate -
Use comfy-cli for management (recommended): comfy-cli automatically manages virtual environments, no manual activation needed.
-
Create a startup script:
# Create start-comfy.sh #!/bin/bash cd ~/your-workspace source comfy-env/bin/activate comfy launchThen add execute permission with
chmod +x start-comfy.sh.
7. PyTorch Installation Issues
Issue: PyTorch download interrupted (Killed)
Solutions:
- Increase system swap space (if memory is insufficient)
- Use a domestic mirror:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130 - Install step by step:
pip install torch --index-url https://download.pytorch.org/whl/cu130 pip install torchvision --index-url https://download.pytorch.org/whl/cu130 pip install torchaudio --index-url https://download.pytorch.org/whl/cu130
Summary
Using Comfy CLI is the best way to install ComfyUI on Linux, offering:
- Simple installation process: Complete installation with one command
- Complete dependency management: Automatically handles all dependencies
- Multi-workspace support: Can manage multiple ComfyUI instances
- Cross-platform compatibility: Works properly on Windows, macOS, and Linux
If you’re new to ComfyUI, we strongly recommend using Comfy CLI for installation and management.
Next Steps
After installation, you can:
- 📖 Check the Complete Comfy CLI User Guide to learn more advanced features
- 🎯 Start your first ComfyUI workflow
- 🔧 Install and manage custom nodes
- 📦 Download and manage models
Related Links
- Complete Comfy CLI User Guide
- Comfy CLI GitHub Repository
- Comfy CLI Official Documentation
- ComfyUI Official Repository
- ComfyUI Official AMD GPU Documentation
- PyTorch Installation Guide