Advertisement
formulake

Install ComfyUI

Jul 5th, 2025 (edited)
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.24 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3.  
  4. :: --- Check for Git ---
  5. echo Checking for Git installation...
  6. git --version >nul 2>&1
  7. if errorlevel 1 (
  8.     echo Git is not installed or not in PATH.
  9.     goto end
  10. )
  11.  
  12. :: --- Check for Python 3.12 ---
  13. echo Checking for Python 3.12...
  14. for /f "tokens=2 delims= " %%A in ('python --version') do set PY_VER=%%A
  15. for /f "tokens=1,2 delims=." %%B in ("%PY_VER%") do (
  16.     set MAJOR=%%B
  17.     set MINOR=%%C
  18. )
  19.  
  20. if not "!MAJOR!"=="3" (
  21.     echo Python 3.x is required. Found: !MAJOR!.!MINOR!
  22.     goto end
  23. )
  24.  
  25. if not "!MINOR!"=="12" (
  26.     echo Python 3.12 is required. Found: !MAJOR!.!MINOR!
  27.     goto end
  28. )
  29.  
  30. :: --- Check for CUDA 12.8 ---
  31. echo Checking for CUDA 12.8 installation...
  32. where nvcc >nul 2>&1
  33. if errorlevel 1 (
  34.     echo CUDA Toolkit not found in PATH. Please install CUDA 12.8.
  35.     goto end
  36. )
  37.  
  38. nvcc --version > temp_cuda.txt
  39. findstr "release 12.8" temp_cuda.txt >nul
  40. if errorlevel 1 (
  41.     echo CUDA 12.8 not found. Please ensure CUDA 12.8 is installed.
  42.     del temp_cuda.txt
  43.     goto end
  44. )
  45. del temp_cuda.txt
  46.  
  47. echo.
  48. echo All environment checks passed.
  49. echo.
  50.  
  51. :: --- Ask user to confirm before proceeding ---
  52. set /p USER_CONFIRM=Proceed with ComfyUI installation? (Y/N):
  53. if /I not "!USER_CONFIRM!"=="Y" (
  54.     echo Installation aborted by user.
  55.     goto end
  56. )
  57.  
  58. echo.
  59. echo Starting installation...
  60.  
  61. :: --- Clone ComfyUI repo ---
  62. git clone https://github.com/comfyanonymous/ComfyUI
  63. if errorlevel 1 goto error
  64.  
  65. cd ComfyUI
  66.  
  67. :: --- Create venv ---
  68. python -m venv venv
  69. if errorlevel 1 goto error
  70.  
  71. :: --- Activate venv ---
  72. call venv\Scripts\activate.bat
  73.  
  74. :: --- Install PyTorch (CUDA 12.8, nightly) ---
  75. pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
  76. if errorlevel 1 goto error
  77.  
  78. :: --- Clone ComfyUI-Manager ---
  79. cd custom_nodes
  80. git clone https://github.com/Comfy-Org/ComfyUI-Manager
  81. if errorlevel 1 goto error
  82.  
  83. cd ComfyUI-Manager
  84. pip install -r requirements.txt
  85. if errorlevel 1 goto error
  86.  
  87. cd ..\..
  88. pip install -r requirements.txt
  89. if errorlevel 1 goto error
  90.  
  91. :: --- Launch ComfyUI ---
  92. python main.py
  93. goto end
  94.  
  95. :error
  96. echo.
  97. echo An error occurred. Please check the messages above.
  98. pause
  99.  
  100. :end
  101. endlocal
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement