File size: 4,031 Bytes
6bfcd28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@Echo off&&cd /D %~dp0
Title ComfyUI-Easy-Install NEXT (Reinstall Mode B – Replace Only)

:: Set Python version
set "PYTHON_VERSION=3.12"

:: Colors
set warning=[33m
set red=[91m
set green=[92m
set yellow=[93m
set bold=[1m
set reset=[0m

:: Arguments
set "PIPargs=--no-cache-dir --no-warn-script-location --timeout=1000 --retries 200"
set "CURLargs=--retry 200 --retry-all-errors"
set "UVargs=--no-cache --link-mode=copy"

echo %green%=== ComfyUI Reinstall (Mode B: Replace Only) ===%reset%
echo.

:: Ensure folder exists
if not exist ComfyUI-Easy-Install (
    echo %red%ERROR:%reset% Folder ComfyUI-Easy-Install not found!
    pause
    exit /b
)

cd ComfyUI-Easy-Install

:: -----------------------------
:: REINSTALL PYTHON EMBEDDED
:: -----------------------------
echo %yellow%Replacing python_embeded...%reset%

if not exist python_embeded md python_embeded

:: Download correct Python version
if "%PYTHON_VERSION%"=="3.11" (set "PYTHON_VER=3.11.9")
if "%PYTHON_VERSION%"=="3.12" (set "PYTHON_VER=3.12.10")

cd python_embeded
del /q * >nul 2>&1

curl.exe -OL https://www.python.org/ftp/python/%PYTHON_VER%/python-%PYTHON_VER%-embed-amd64.zip --ssl-no-revoke %CURLargs%
tar.exe -xf python-%PYTHON_VER%-embed-amd64.zip
del python-%PYTHON_VER%-embed-amd64.zip

curl.exe -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py --ssl-no-revoke %CURLargs%

:: Create .pth
echo ../ComfyUI> python312._pth
echo python312.zip>> python312._pth
echo .>> python312._pth
echo Lib/site-packages>> python312._pth
echo Lib>> python312._pth
echo Scripts>> python312._pth
echo # import site>> python312._pth

.\python.exe -I get-pip.py %PIPargs%
.\python.exe -I -m pip install uv %PIPargs%

cd ..

:: -----------------------------
:: REINSTALL COMFYUI FILES ONLY
:: -----------------------------
echo %yellow%Updating ComfyUI core files...%reset%

if not exist ComfyUI md ComfyUI

:: Clone to temp folder
git.exe clone https://github.com/comfyanonymous/ComfyUI ComfyUI_NEW

:: Copy only core folders (replace)
xcopy ComfyUI_NEW\comfy ComfyUI\comfy /E /Y /I /Q
xcopy ComfyUI_NEW\app ComfyUI\app /E /Y /I /Q
xcopy ComfyUI_NEW\web ComfyUI\web /E /Y /I /Q
xcopy ComfyUI_NEW\api_server ComfyUI\api_server /E /Y /I /Q
xcopy ComfyUI_NEW\comfy_api ComfyUI\comfy_api /E /Y /I /Q
xcopy ComfyUI_NEW\comfy_api_nodes ComfyUI\comfy_api_nodes /E /Y /I /Q
xcopy ComfyUI_NEW\utils ComfyUI\utils /E /Y /I /Q

:: Replace main files
copy /Y ComfyUI_NEW\main.py ComfyUI\
copy /Y ComfyUI_NEW\server.py ComfyUI\
copy /Y ComfyUI_NEW\execution.py ComfyUI\
copy /Y ComfyUI_NEW\folder_paths.py ComfyUI\
copy /Y ComfyUI_NEW\comfyui_version.py ComfyUI\
copy /Y ComfyUI_NEW\requirements.txt ComfyUI\

:: Remove temp clone
rmdir /s /q ComfyUI_NEW

:: -----------------------------
:: INSTALL REQUIREMENTS
:: -----------------------------
echo %yellow%Installing requirements...%reset%
.\python_embeded\python.exe -I -m uv pip install -r ComfyUI\requirements.txt %UVargs%

:: -----------------------------
:: REINSTALL ADDITIONAL NODES (NO DELETE)
:: -----------------------------
echo %yellow%Installing extra nodes (non-destructive)...%reset%

call :get_node https://github.com/Comfy-Org/ComfyUI-Manager comfyui-manager
call :get_node https://github.com/WASasquatch/was-node-suite-comfyui was-node-suite-comfyui
call :get_node https://github.com/yolain/ComfyUI-Easy-Use ComfyUI-Easy-Use
call :get_node https://github.com/Fannovel16/comfyui_controlnet_aux comfyui_controlnet_aux

echo %green%=== Reinstall Complete (Mode B) ===%reset%
pause
exit /b

:get_node
set git_url=%~1
set git_folder=%~2
echo Installing %git_folder%...
if not exist ComfyUI\custom_nodes md ComfyUI\custom_nodes
git.exe clone %git_url% ComfyUI\custom_nodes\%git_folder% 2>nul
if exist ComfyUI\custom_nodes\%git_folder%\requirements.txt (
    .\python_embeded\python.exe -I -m uv pip install -r ComfyUI\custom_nodes\%git_folder%\requirements.txt %UVargs%
)
echo.
goto :eof