Skip to content

Instantly share code, notes, and snippets.

@potatoattack
Created March 3, 2025 09:38
Show Gist options
  • Select an option

  • Save potatoattack/6c0bd9b63849c97d7dc561d1b6665b05 to your computer and use it in GitHub Desktop.

Select an option

Save potatoattack/6c0bd9b63849c97d7dc561d1b6665b05 to your computer and use it in GitHub Desktop.
Install ComfyUI on Arch
# Install dependencies. Change `python-pytorch-rocm` to the package that supports your GPU or `python-pytorch` for CPU.
pacman -Syu base-devel git python-pytorch-rocm python-torchvision python-torchaudio libwebp

# Add a user for ComfyUI to run as.
useradd -U -r -s /usr/bin/nologin -d /var/lib/comfyui comfyui

# Clone the latest version of ComfyUI.
git clone https://github.com/comfyanonymous/ComfyUI.git /var/lib/comfyui

# Create the virtual env using system packages when available (the deps above).
python -m venv --system-site-packages /var/lib/comfyui/.venv

# Install the required libs in venv.
source /var/lib/comfyui/.venv/bin/activate && pip install -r /var/lib/comfyui/requirements.txt

# Own the dir to the correct user/group.
chown -R comfyui:comfyui /var/lib/comfyui

# Create the service file.
cat > /etc/systemd/system/comfyui.service <<EOF
[Unit]
Description=ComfyUI
After=network-online.target

[Service]
Type=simple
User=comfyui
Group=comfyui
StateDirectory=comfyui
CacheDirectory=comfyui
WorkingDirectory=/var/lib/comfyui
Environment=HOME=/var/lib/comfyui
ExecStart=/bin/bash -c 'source /var/lib/comfyui/.venv/bin/activate && exec python /var/lib/comfyui/main.py --listen'
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF

# Start the service and ComfyUI should be available on `ip_address:8188`.
systemctl enable --now comfyui.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment