How to Run ComfyUI Locally on Ubuntu with NVIDIA GPU Acceleration
This deep-dive covers Run ComfyUI Ubuntu NVIDIA GPU with actionable analysis, practical implications, and expert insights.
ComfyUI has quickly become the preferred modular interface for image and video synthesis workflows due to its graph-based node architecture, fast execution speed, and low memory footprint compared to monolithic web UIs. Running ComfyUI locally on Ubuntu ensures complete privacy and zero monthly subscription fees.
This guide walks you through preparing your NVIDIA drivers, installing PyTorch with CUDA 12 support, cloning ComfyUI, and executing your first generation workflow with high performance.
Direct Answer: Essential Hardware and Software Requirements
To run modern diffusion models like SDXL or FLUX.1 on Ubuntu 24.04 LTS, you need an NVIDIA GPU with at least 8GB of VRAM (12GB+ recommended for FLUX), proprietary NVIDIA driver 535 or higher, Python 3.10 or newer, and PyTorch with CUDA 12.4 support.
Step 1: Verify NVIDIA Driver and CUDA Compatibility
Open a terminal and verify that your proprietary NVIDIA driver is properly detected:
nvidia-smi
If the command fails or shows an open source Nouveau driver, install the tested proprietary driver via APT:
sudo apt update
sudo apt install -y nvidia-driver-550-server nvidia-utils-550-server
sudo reboot
Step 2: Clone ComfyUI and Configure Python Virtual Environment
Isolate ComfyUI dependencies from system packages using a dedicated virtual environment:
# Install python venv and git
sudo apt install -y python3-venv python3-pip git
# Clone ComfyUI repository
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install PyTorch with CUDA 12.4 acceleration
pip install --upgrade pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
# Install ComfyUI dependencies
pip install -r requirements.txt
Step 3: Download Model Checkpoints
Place your diffusion checkpoints in the models/checkpoints directory. For high-speed test generations, download the SDXL Turbo checkpoint:
cd models/checkpoints
wget -c https://huggingface.co/stabilityai/sdxl-turbo/resolve/main/sd_xl_turbo_1.0_fp16.safetensors
cd ../..
Step 4: Launch ComfyUI with GPU Optimization Flags
Start the ComfyUI local server with memory management parameters optimized for Linux:
python main.py --listen 127.0.0.1 --port 8188 --preview-method auto
Open your web browser and navigate to http://127.0.0.1:8188. You will see the default node graph. Click Queue Prompt to generate your first test image in under 3 seconds.
Creating a Systemd Service for Background Operation
To keep ComfyUI running automatically on system boot, create a systemd user service:
# ~/.config/systemd/user/comfyui.service
[Unit]
Description=ComfyUI AI Image Generation Service
After=network.target
[Service]
Type=simple
WorkingDirectory=%h/ComfyUI
ExecStart=%h/ComfyUI/venv/bin/python main.py --listen 127.0.0.1 --port 8188
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user enable --now comfyui.service
For more local AI deployment patterns, explore our guide on Deploying Open WebUI with Docker on Ubuntu and our tutorial on Docker vs Podman Rootless Containers Benchmarked.
Was this technical analysis helpful?
Your feedback informs our benchmark updates and ongoing article audits.
Newsletter
Practical Linux & Applied AI Newsletter
Get new tested tutorials and benchmark comparisons delivered directly to your inbox. Zero spam.
Join Weekly guides readers getting our weekly digest.
- Practical Linux administration & terminal workflows
- Tested open-source AI setups & benchmarks
- Zero spam - unsubscribe anytime