-
-
Save sinsunsan/6705808c4e2efb487146c4ef8b3a40da to your computer and use it in GitHub Desktop.
Deploying ComfyUI on RunPod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#You only need to run this script once. However, when you start a new runpod server, you will need to initialize conda in the shell. | |
#1. run the following command to intialize conda in the shell | |
#/workspace/miniconda3/bin/conda init bash | |
#2. run the following command to activate the conda environment | |
#conda activate comfyui | |
#3. run the following command to start comfyui | |
#python main.py --listen | |
#!/bin/bash | |
#ComfyUI single environment setup | |
echo " | |
======================================== | |
π Starting ComfyUI setup... | |
======================================== | |
" | |
# Create base directories | |
echo " | |
---------------------------------------- | |
π Creating base directories... | |
----------------------------------------" | |
mkdir -p /workspace/ComfyUI | |
mkdir -p /workspace/miniconda3 | |
# Download and install Miniconda | |
echo " | |
---------------------------------------- | |
π₯ Downloading and installing Miniconda... | |
----------------------------------------" | |
if [ ! -f "/workspace/miniconda3/bin/conda" ]; then | |
cd /workspace/miniconda3 | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
chmod +x Miniconda3-latest-Linux-x86_64.sh | |
./Miniconda3-latest-Linux-x86_64.sh -b -p /workspace/miniconda3 -f | |
else | |
echo "Miniconda already installed, skipping..." | |
fi | |
# Initialize conda in the shell | |
echo " | |
---------------------------------------- | |
π Initializing conda... | |
----------------------------------------" | |
eval "$(/workspace/miniconda3/bin/conda shell.bash hook)" | |
# Clone ComfyUI | |
echo " | |
---------------------------------------- | |
π₯ Cloning ComfyUI repository... | |
----------------------------------------" | |
if [ ! -d "/workspace/ComfyUI/.git" ]; then | |
git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI | |
else | |
echo "ComfyUI already exists in /workspace/ComfyUI, skipping clone..." | |
fi | |
# Clone ComfyUI-Manager | |
echo " | |
---------------------------------------- | |
π₯ Installing ComfyUI-Manager... | |
----------------------------------------" | |
if [ ! -d "/workspace/ComfyUI/custom_nodes/ComfyUI-Manager/.git" ]; then | |
git clone https://github.com/ltdrdata/ComfyUI-Manager.git /workspace/ComfyUI/custom_nodes/ComfyUI-Manager | |
else | |
echo "ComfyUI-Manager already exists, skipping clone..." | |
fi | |
# Clone RyanOnTheInside nodes | |
echo " | |
---------------------------------------- | |
π₯ Installing ComfyUI RyanOnTheInside nodes... | |
----------------------------------------" | |
if [ ! -d "/workspace/ComfyUI/custom_nodes/ComfyUI_RyanOnTheInside/.git" ]; then | |
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside.git /workspace/ComfyUI/custom_nodes/ComfyUI_RyanOnTheInside | |
else | |
echo "ComfyUI RyanOnTheInside nodes already exist, skipping clone..." | |
fi | |
# Create conda environment | |
echo " | |
---------------------------------------- | |
π Creating conda environment... | |
----------------------------------------" | |
if ! conda info --envs | grep -q "comfyui"; then | |
conda create -n comfyui python=3.11 -y | |
else | |
echo "comfyui environment already exists, skipping creation..." | |
fi | |
# Setup comfyui environment | |
echo " | |
---------------------------------------- | |
π§ Setting up comfyui environment... | |
----------------------------------------" | |
echo "π Activating comfyui environment..." | |
set -x # Enable debug mode to see each command | |
conda activate comfyui | |
RESULT=$? | |
echo "Activation exit code: $RESULT" | |
if [ "$CONDA_DEFAULT_ENV" != "comfyui" ]; then | |
echo "β Failed to activate comfyui environment! Current env: $CONDA_DEFAULT_ENV" | |
exit 1 | |
fi | |
echo "β Successfully activated comfyui environment" | |
# Install requirements | |
cd /workspace/ComfyUI | |
echo "π¦ Installing ComfyUI requirements..." | |
pip install -r requirements.txt | |
cd custom_nodes/ComfyUI-Manager | |
echo "π¦ Installing ComfyUI-Manager requirements..." | |
pip install -r requirements.txt | |
if [ -f "/workspace/ComfyUI/custom_nodes/ComfyUI_RyanOnTheInside/requirements.txt" ]; then | |
echo "π¦ Installing RyanOnTheInside nodes requirements..." | |
cd /workspace/ComfyUI/custom_nodes/ComfyUI_RyanOnTheInside | |
pip install -r requirements.txt | |
fi | |
# Return to base environment | |
echo "π Deactivating comfyui environment..." | |
conda deactivate | |
echo "β Successfully deactivated comfyui environment" | |
set +x # Disable debug mode | |
echo " | |
======================================== | |
β¨ Setup complete! β¨ | |
======================================== | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment