Skip to main content
comfyanonymous /

ComfyUI

A node-based workflow builder for advanced image and video generation, ideal for custom pipelines, fine control, and power users.

Image GenerationVideo GenerationAudio GenerationAdvanced
Version6265a23
Python3.11
EnvironmentPython (uv)
InterfaceWeb UI + API
GPURequired
Securely deploy ComfyUI on Laboratory OS.
Create powerful and fast image generation pipelines

ComfyUI

Laboratory OS Installation Details

Environment

Git Repohttps://github.com/comfyanonymous/ComfyUI
Working Directory/workspace/ComfyUI
Python3.11
Env Manageruv

Environment Variables

APP_DIRECTORY
/workspace/ComfyUI
COMFY_UI_PORT
<assigned at runtime>
APP_VERSIONWhich version of the app to use, using a git branch name or commit hash.
6265a23

Install & Run

install-and-run.sh
#!/bin/bash
set -e

export PATH="/opt/conda/bin:/root/.local/bin:$PATH"

# Clone the GitHub repository into the directory when needed
mkdir -p "/workspace/ComfyUI"
if [ -d "/workspace/ComfyUI/.git" ]; then
  echo "Git repository already initialized in /workspace/ComfyUI"
elif [ -z "$(ls -A "/workspace/ComfyUI" 2>/dev/null)" ]; then
  git clone --progress "https://github.com/comfyanonymous/ComfyUI" "/workspace/ComfyUI"
else
  echo "Working directory /workspace/ComfyUI already exists and is not a git repository."
  echo "Leaving existing files untouched and skipping clone of https://github.com/comfyanonymous/ComfyUI."
fi
  
# Change to the app directory
cd "/workspace/ComfyUI"

# Install the requested Python version and create a virtual environment when needed
uv python install 3.11
if [ ! -d ".venv" ]; then
  uv venv --seed --python 3.11 .venv
else
  echo "Virtual environment already exists at /workspace/ComfyUI/.venv"
fi

# Activate the virtual environment
source .venv/bin/activate


# Install PyTorch
uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu128

# Environment setup complete
echo "Environment setup complete!"

mkdir -p $APP_DIRECTORY/user/default/workflows
pip install -r requirements.txt
git clone https://github.com/ltdrdata/ComfyUI-Manager $APP_DIRECTORY/custom_nodes/ComfyUI-Manager || true

python main.py --listen --port $COMFY_UI_PORT $OPENLAB_EXTRA_ARGS