Skip to content

r-vage/ComfyUI-Installation-Script-for-Linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ComfyUI Installation Script for Linux & Windows

Automated installation scripts for ComfyUI on Linux and Windows systems that handle everything from Python environment setup to custom node installation. These scripts provide a streamlined, dependency-conflict-free installation process with full control over package versions and installation steps.

🌟 Features

  • Automated Environment Setup: Installs pyenv, Python, and creates an isolated virtual environment
  • Version Control: Pin specific versions of ComfyUI, PyTorch, NumPy, Transformers, and other critical packages
  • GPU Acceleration: Supports CUDA 13.0, CUDA 12.8, CUDA 12.6, ROCm 7.1, and CPU-only installations
  • Performance Optimization: Includes optional Nunchaku, Flash Attention, and Sage Attention
  • Custom Node Collection: Automatically clones and configures 30+ popular custom nodes
  • Selective Installation: Choose which components to install via interactive menu
  • Smart Dependency Management: Prevents version conflicts by enforcing package versions
  • Symlink Support: Centralize models and outputs across multiple installations
  • Shell Integration: Adds convenient aliases (comfyui, envact) to your shell
  • Multiple Shell Support: Auto-detects and configures bash, zsh, and fish shells

πŸ“‹ Prerequisites

Linux

  • Operating System: Linux (Ubuntu, Debian, Fedora, Arch, openSUSE, etc.)
  • Permissions: Sudo access for installing system dependencies
  • Disk Space: ~10-20GB for full installation (varies with custom nodes)
  • GPU (optional): NVIDIA GPU with CUDA support for acceleration features
  • Git: For cloning repositories

Windows

  • Operating System: Windows 10 or Windows 11
  • PowerShell: Version 5.1+ (included with Windows 10/11) or PowerShell 7+
  • Disk Space: ~10-20GB for full installation
  • GPU (optional): NVIDIA GPU with CUDA support for acceleration features
  • Git: Git for Windows installed and in PATH (download)
  • Visual Studio Build Tools (optional): Required only if building packages from source (e.g., flash-attn)

πŸš€ Quick Start

Linux

# Download the script
git clone https://github.com/yourusername/ComfyUI-Installation-Script-for-Linux.git
cd ComfyUI-Installation-Script-for-Linux

# Make executable
chmod +x install_comfy_env.sh

# Run the script
./install_comfy_env.sh

Windows

# Download the script
git clone https://github.com/yourusername/ComfyUI-Installation-Script-for-Linux.git
cd ComfyUI-Installation-Script-for-Linux

# Allow script execution (if not already enabled)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Run the script
.\install_comfy_env_win.ps1

Note: The Windows script uses directory junctions (similar to symlinks) which work without Administrator privileges. If you need true symlinks, run PowerShell as Administrator.

The script will display your configuration and prompt you to select which installation steps to run.

βš™οΈ Configuration

Before running the script, you can customize these variables at the top of install_comfy_env.sh (Linux) or install_comfy_env_win.ps1 (Windows):

Python Configuration

PYTHON_VERSION="3.12.10"          # Python version (3.10.x, 3.11.x, 3.12.x, 3.13.x, 3.14.x recommended)
VENV_PATH="/mnt/daten/AI/comfy_env"  # Virtual environment location
PYENV_ROOT="${PYENV_ROOT:-$HOME/.pyenv}"  # pyenv installation directory

Windows equivalent: $PYTHON_VERSION = "3.12.10" β€” venv path defaults to $BASE_PATH\comfy_env (e.g. D:\AI\comfy_env)

Recommended Python versions: 3.10.x, 3.11.x, 3.12.x, 3.13.x, 3.14.x have prebuilt wheels for PyTorch, Nunchaku, and Flash Attention. Other versions will require compilation from source.

PyTorch Configuration

PYTORCH_VERSION="2.9"             # PyTorch major.minor for wheel URLs
PYTORCH_FULL_VERSION="2.9.1+cu128" # Full version string
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cu128"  # Wheel repository

Available options:

  • CUDA 13.0: cu130 (latest)
  • CUDA 12.8: cu128 (default)
  • CUDA 12.6: cu126
  • ROCm 7.1: rocm7.1 (AMD GPUs)
  • CPU only: cpu (no GPU)

Example CUDA 13.0 configuration:

PYTORCH_FULL_VERSION="2.9.1+cu130"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cu130"

Example ROCm 7.1 configuration (AMD GPUs):

PYTORCH_FULL_VERSION="2.9.1+rocm7.1"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/rocm7.1"

Example CPU configuration:

PYTORCH_FULL_VERSION="2.9.1+cpu"
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/cpu"

Critical Package Versions

NUMPY_VERSION="2.2.6"             # NumPy version (2.2.x for PyTorch 2.9+)
TRANSFORMERS_VERSION="4.57.3"      # Transformers (4.57+ for Qwen3-VL/Mistral3)
COMFYUI_FRONTEND_VERSION="1.39.11" # ComfyUI frontend (installed in venv's site-packages)

These versions are enforced at the end of installation to override any conflicting dependencies from custom nodes.

ComfyUI Installation

COMFYUI_PARENT_DIR="/mnt/daten/AI"  # Parent directory for ComfyUI
COMFYUI_DIR_NAME="ComfyUI"          # Folder name
COMFYUI_VERSION=""                  # ComfyUI version (tag, branch, or commit SHA)

Windows equivalent: $BASE_PATH = "D:\AI" β€” ComfyUI clones to D:\AI\ComfyUI

ComfyUI will be cloned to: ${COMFYUI_PARENT_DIR}/${COMFYUI_DIR_NAME}

Version Selection:

  • Leave COMFYUI_VERSION="" (empty) to clone the latest version from the default branch
  • Set to a specific tag: COMFYUI_VERSION="v0.2.0" (use tags from the ComfyUI releases)
  • Set to a branch name: COMFYUI_VERSION="master" or COMFYUI_VERSION="dev"
  • Set to a commit SHA: COMFYUI_VERSION="abc123def456"

Examples:

COMFYUI_VERSION=""              # Latest version (default)
COMFYUI_VERSION="v0.2.0"        # Specific release tag
COMFYUI_VERSION="master"        # Master branch
COMFYUI_VERSION="abc123"        # Specific commit

Multiple ComfyUI Installations: To install multiple versions of ComfyUI side-by-side, simply change COMFYUI_DIR_NAME when running the script again:

# First installation
COMFYUI_DIR_NAME="ComfyUI"        # Creates /mnt/daten/AI/ComfyUI

# Second installation (different version)
COMFYUI_DIR_NAME="ComfyUI_v0.2.0" # Creates /mnt/daten/AI/ComfyUI_v0.2.0
COMFYUI_VERSION="v0.2.0"

When CREATE_SYMLINKS=true, all installations will share:

  • Models (via USER_MODELS_PATH)
  • Output (via USER_OUTPUT_PATH)
  • Custom nodes (via USER_CUSTOM_NODES_PATH)

This allows you to test different ComfyUI versions without duplicating your models and custom nodes.

Symlink / Junction Configuration

CREATE_SYMLINKS=true                # Enable/disable symlink creation
USER_MODELS_PATH="/mnt/daten/AI/models"  # Centralized models directory
USER_OUTPUT_PATH="/mnt/daten/AI/output"  # Centralized output directory
USER_CUSTOM_NODES_PATH="/mnt/daten/AI/custom_nodes"  # Centralized custom_nodes directory

Windows equivalent: $CREATE_SYMLINKS = $true β€” paths default to D:\AI\models, D:\AI\output, D:\AI\custom_nodes (uses directory junctions instead of symlinks)

Symlinks allow you to:

  • Share models across multiple ComfyUI installations
  • Share custom nodes across multiple ComfyUI installations (useful when testing different ComfyUI versions)
  • Store models on a different drive/partition
  • Keep outputs in a centralized location

Set CREATE_SYMLINKS=false to use default ComfyUI/models, ComfyUI/output, and ComfyUI/custom_nodes directories.

Tip β€” directories outside BASE_PATH: By default, USER_MODELS_PATH, USER_OUTPUT_PATH, and USER_CUSTOM_NODES_PATH are derived from BASE_PATH. You can point any of them to a completely different location β€” for example a larger disk β€” by editing the "Derived Paths" section in the script:

Linux:

USER_MODELS_PATH="/mnt/ssd2/models"           # Models on a fast SSD
USER_OUTPUT_PATH="/home/$USER/comfyui_output"  # Output in home directory

Windows:

$USER_MODELS_PATH = "E:\models"                         # Models on drive E:
$USER_OUTPUT_PATH = "C:\Users\$env:USERNAME\comfyui_out" # Output in user profile

The script creates the target directories automatically and symlinks/junctions them into the ComfyUI tree.

Optional Features

INSTALL_NUNCHAKU=true               # Nunchaku acceleration (requires NVIDIA GPU)

Set to false to skip Nunchaku installation if you don't have an NVIDIA GPU or don't need this optimization.

πŸ“¦ What Gets Installed

Installation Steps

The script is divided into 11 steps that you can run selectively:

  1. Python Environment - pyenv, Python version, virtual environment
  2. PyTorch - PyTorch, torchvision, torchaudio with CUDA/CPU support
  3. Nunchaku - Acceleration library (optional, NVIDIA GPU only)
  4. Face Recognition - facexlib, insightface, onnxruntime-gpu, facenet_pytorch
  5. ComfyUI Core - ComfyUI base installation and requirements
  6. Custom Nodes - 30+ popular custom nodes (see list below)
  7. Custom Node Dependencies - Install requirements for all custom nodes
  8. Performance Libraries - llama-cpp-python, flash-attn, sageattention
  9. Upgrade/Pin Packages - Upgrade specific packages to latest compatible versions
  10. Enforce Versions - Force exact versions of PyTorch, NumPy, Transformers, ComfyUI Frontend
  11. Shell Aliases - Add comfyui and envact aliases to shell config

Custom Nodes Included

Core Extensions

  • ComfyUI_SmartLML - Smart Language Model Loader
  • ComfyUI_Eclipse - Extended toolkit
  • ComfyUI-Manager - Node manager

UI & Workflow Tools

  • ComfyUI-Crystools-MonitorOnly - System monitoring
  • ComfyUI-Custom-Scripts - UI enhancements
  • rgthree-comfy - Workflow utilities
  • ComfyUI-Easy-Use - Simplified nodes
  • ComfyUI_essentials - Essential utilities
  • ComfyUI_essentials_mb - Additional essentials

Model Support & Optimization

  • ComfyUI-GGUF - GGUF model support
  • ComfyUI-nunchaku - Nunchaku integration
  • ComfyUI-TeaCache - Caching optimizations
  • ComfyUI_Patches_ll - Performance patches

ControlNet & Advanced Control

  • ComfyUI-Advanced-ControlNet - Advanced ControlNet features
  • comfyui_controlnet_aux - ControlNet preprocessors

Image Processing & Effects

  • ComfyUI-Impact-Pack - Image enhancement suite
  • ComfyUI_LayerStyle - Layer effects
  • ComfyUI_LayerStyle_Advance - Advanced layer effects
  • ComfyUI-Detail-Daemon - Detail enhancement
  • ComfyUI-KJNodes - Various utilities
  • Comfyui_TTP_Toolset - Additional tools
  • ComfyUI-Raffle - Random generation
  • sd-dynamic-thresholding - Dynamic thresholding
  • was-node-suite-comfyui - WAS toolkit

Specialized Models

  • ComfyUI-Florence2 - Florence2 model support
  • ComfyUI-SUPIR - Super resolution
  • ComfyUI_BiRefNet_ll - Background removal
  • ComfyUI_PuLID_Flux_ll - Face ID for Flux
  • ComfyUI-ReActor - Face swapping

Video Processing

  • ComfyUI-VideoHelperSuite - Video utilities
  • ComfyUI-Frame-Interpolation - Video frame interpolation
  • ComfyUI-GIMM-VFI - Video frame interpolation
  • ComfyUI-WanVideoWrapper - Video processing

Custom/Additional

  • RES4LYF - Resolution presets
  • comfy_mtb - MTB's custom nodes

🎯 Usage

Interactive Installation

Run the script and select steps interactively:

./install_comfy_env.sh

You'll see a menu:

Select installation steps (enter numbers separated by spaces, or 'a' for all):
  1) Python environment (pyenv + venv)
  2) PyTorch and base dependencies
  ...
  a) All steps (default)

Your selection [a]:

Examples:

  • a - Install everything (default)
  • 1 2 5 - Only setup Python, PyTorch, and ComfyUI core
  • 6 7 - Only clone and setup custom nodes (if you already have ComfyUI)
  • 10 - Only enforce package versions (useful after manual package changes)

Running ComfyUI

After installation, you have several options:

Linux

Option 1: Launcher script (recommended)

/mnt/daten/AI/start_comfyui.sh

Option 2: Shell alias (if Step 11 was run)

comfyui

Option 3: Manual

source /mnt/daten/AI/comfy_env/bin/activate
cd /mnt/daten/AI/ComfyUI
python main.py

Windows

Option 1: Double-click launcher

D:\AI\start_comfyui.bat

Option 2: PowerShell launcher

D:\AI\start_comfyui.ps1

Option 3: PowerShell alias (if Step 11 was run, after reloading profile)

comfyui

Option 4: Manual

& "D:\AI\comfy_env\Scripts\Activate.ps1"
cd "D:\AI\ComfyUI"
python main.py

Activating Virtual Environment Only

# If aliases are configured (Step 11)
envact

# Or manually
source /mnt/daten/AI/comfy_env/bin/activate

πŸ”§ Customizing Custom Nodes

To add/remove custom nodes, edit the [6/10] Clone Custom Nodes section around line 550:

# Add your custom node:
clone_if_missing "https://github.com/yourusername/your-custom-node.git"

# Remove a node by commenting it out or deleting the line:
# clone_if_missing "https://github.com/some/node-you-dont-want.git"

Then run:

./install_comfy_env.sh

And select steps 6 7 to update custom nodes and their dependencies.

πŸ› Troubleshooting

pyenv Installation Fails

If pyenv dependencies fail to install, you may need to manually install build dependencies for your distribution:

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Fedora:

sudo dnf install make gcc patch zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel xz-devel libuuid-devel gdbm-libs libnsl2

Nunchaku or Flash Attention Installation Fails

These require:

  • NVIDIA GPU
  • CUDA 12.6+ or compatible version
  • Prebuilt wheels for your Python version

If you don't have an NVIDIA GPU, set INSTALL_NUNCHAKU=false and skip step 3.

Custom Node Dependencies Conflict

If a custom node installs incompatible package versions, run step 10 to enforce configured versions:

./install_comfy_env.sh  # Select step 10 only

Shell Aliases Not Working

Linux

After step 11, you need to reload your shell configuration:

# For bash
source ~/.bashrc

# For zsh
source ~/.zshrc

# For fish
source ~/.config/fish/config.fish

# Or just restart your terminal

Windows

After step 11, reload your PowerShell profile:

. $PROFILE

# Or just restart PowerShell

Windows: Execution Policy Error

If you get a script execution error:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Windows: pyenv-win Not Found After Installation

Close and reopen PowerShell. If still not found, ensure these are in your PATH:

  • %USERPROFILE%\.pyenv\pyenv-win\bin
  • %USERPROFILE%\.pyenv\pyenv-win\shims

Windows: Flash Attention Not Available

Flash Attention rarely has prebuilt Windows wheels. You can either:

  • Skip it (it's optional β€” ComfyUI works fine without it)
  • Install Visual Studio Build Tools and compile from source
  • Use Sage Attention as an alternative

Out of Disk Space

The full installation requires 10-20GB. To reduce space:

  • Skip custom nodes (don't run step 6-7)
  • Remove unused custom nodes manually from custom_nodes/ directory
  • Use symlinks to store models on a different drive

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes:
    • Add new custom nodes to the installation list
    • Update package versions
    • Add support for new Linux distributions
    • Improve error handling
  4. Test your changes on a fresh system if possible
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Reporting Issues

When reporting issues, please include:

  • Your Linux distribution and version
  • Python version being installed
  • Full error output
  • Which installation step failed

πŸ“ License

This script is provided as-is for the ComfyUI community. Feel free to modify and distribute.

πŸ™ Acknowledgments

  • ComfyUI - The amazing stable diffusion GUI
  • pyenv - Python version management (Linux)
  • pyenv-win - Python version management (Windows)
  • All the custom node developers for their incredible work

πŸ“ž Support

If you encounter issues:

  1. Check the Troubleshooting section
  2. Search existing Issues
  3. Open a new issue with detailed information

Happy ComfyUI-ing! 🎨

About

installation script for linux that installs pyenv, the selected python version. creates and activates the venv. it installs a specific comfyui / frontend version, pytorch and a set of custom nodes. it supports symlinks for models, output folder and custom node folder (for multi comfyui setups)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors