iRedHat commited on
Commit
12bbbb2
·
verified ·
1 Parent(s): a31b284

Upload 4 files

Browse files
Files changed (4) hide show
  1. get-pip.py +0 -0
  2. install_modules.py +138 -0
  3. my-install-python.bat +49 -0
  4. my-install.bat +114 -0
get-pip.py ADDED
The diff for this file is too large to render. See raw diff
 
install_modules.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import sys
3
+ import os
4
+ import urllib.request
5
+
6
+ def colored(text, color):
7
+ """
8
+ Функция для вывода цветного текста в консоль.
9
+ """
10
+ colors = {
11
+ 'red': '\033[91m',
12
+ 'green': '\033[92m',
13
+ 'yellow': '\033[93m',
14
+ 'blue': '\033[94m',
15
+ 'magenta': '\033[95m',
16
+ 'cyan': '\033[96m',
17
+ 'white': '\033[97m',
18
+ }
19
+ return colors.get(color, '') + text + '\033[0m'
20
+
21
+ def uninstall_module(module_name, python_path):
22
+ """
23
+ Функция для деинсталляции модуля.
24
+ """
25
+ print(colored(f"Удаление модуля {module_name}...", 'red'))
26
+ pip_path = os.path.join(python_path, "Scripts", "pip.exe")
27
+ subprocess.run([
28
+ pip_path,
29
+ "uninstall",
30
+ "-y",
31
+ module_name
32
+ ])
33
+
34
+ def download_file(url, filename):
35
+ """
36
+ Функция для загрузки файла с помощью urllib.request.
37
+ """
38
+ print(colored(f"Загрузка файла {filename}...", 'red'))
39
+ try:
40
+ with urllib.request.urlopen(url) as response, open(filename, 'wb') as f:
41
+ f.write(response.read())
42
+ print(colored(f"Файл {filename} успешно загружен.", 'red'))
43
+ except Exception as e:
44
+ print(colored(f"Ошибка при загрузке файла: {e}", 'red'))
45
+
46
+ def install_module(filename, python_path):
47
+ """
48
+ Функция для установки модуля из файла .whl.
49
+ """
50
+ print(colored(f"Установка модуля из {filename}...", 'red'))
51
+ pip_path = os.path.join(python_path, "Scripts", "pip.exe")
52
+ subprocess.run([
53
+ pip_path,
54
+ "install",
55
+ filename
56
+ ])
57
+
58
+ def install_from_index(module_name, index_url, python_path):
59
+ """
60
+ Функция для установки модуля из указанного индекса.
61
+ """
62
+ print(colored(f"Установка модуля {module_name} с индекса {index_url}...", 'red'))
63
+ pip_path = os.path.join(python_path, "Scripts", "pip.exe")
64
+ subprocess.run([
65
+ pip_path,
66
+ "install",
67
+ "--extra-index-url",
68
+ index_url,
69
+ module_name
70
+ ])
71
+
72
+ if __name__ == "__main__":
73
+ # Получение пути к текущей директории
74
+ current_dir = os.path.dirname(os.path.abspath(__file__))
75
+
76
+ # Создание полного пути к папке Python
77
+ python_path = os.path.join(current_dir, "python_embeded")
78
+
79
+ # Определение путей к git
80
+ git_path = os.path.join(current_dir, "git")
81
+ git_bin_path = os.path.join(git_path, "bin")
82
+ git_libexec_path = os.path.join(git_path, "libexec")
83
+
84
+ # Обновление переменной PATH
85
+ os.environ['PATH'] = f"{git_bin_path};{git_libexec_path};{os.environ['PATH']}"
86
+
87
+ # Установка Comfy
88
+ print(colored("Установка Comfy", 'red'))
89
+ git_exe_path = os.path.join(git_bin_path, "git.exe")
90
+
91
+ subprocess.run([
92
+ git_exe_path,
93
+ "clone",
94
+ "https://github.com/comfyanonymous/ComfyUI"
95
+ ])
96
+
97
+ # Обновление
98
+ modules_to_uninstall = ["numpy", "onnxruntime", "onnxruntime-gpu", "torch", "torchvision", "torchaudio"]
99
+ for module in modules_to_uninstall:
100
+ uninstall_module(module, python_path)
101
+
102
+ # Обновление модуля pip
103
+ print(colored("Установка модуля numpy==1.26.4...", 'red'))
104
+ pip_path = os.path.join(python_path, "Scripts", "pip.exe")
105
+ subprocess.run([
106
+ pip_path, # Добавлен путь к pip.exe
107
+ "install",
108
+ "--upgrade",
109
+ "pip"
110
+ ])
111
+
112
+ # Установка numpy==1.26.4
113
+ print(colored("Установка модуля numpy==1.26.4...", 'red'))
114
+ pip_path = os.path.join(python_path, "Scripts", "pip.exe")
115
+ subprocess.run([
116
+ pip_path, # Добавлен путь к pip.exe
117
+ "install",
118
+ "numpy==1.26.4"
119
+ ])
120
+
121
+ # Загрузка файла insightface-0.7.3-cp311-cp311-win_amd64.whl
122
+ url = "https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp311-cp311-win_amd64.whl"
123
+ filename = "insightface-0.7.3-cp311-cp311-win_amd64.whl"
124
+ download_file(url, filename)
125
+
126
+ # Установка модуля из файла .whl
127
+ install_module(filename, python_path)
128
+
129
+ # Установка onnxruntime-gpu из сетевого ресурса
130
+ onnxruntime_index = "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/"
131
+ install_from_index("onnxruntime-gpu", onnxruntime_index, python_path)
132
+
133
+ pytorch_index = "https://download.pytorch.org/whl/cu124"
134
+ install_from_index("torch", pytorch_index, python_path)
135
+ install_from_index("torchvision", pytorch_index, python_path)
136
+ install_from_index("torchaudio", pytorch_index, python_path)
137
+
138
+ print(colored("Установка завершена.", 'green'))
my-install-python.bat ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal
3
+ chcp 65001 > nul
4
+ set target_dir=%~dp0
5
+ set custom_n=%target_dir%ComfyUI\custom_nodes
6
+ set py=%target_dir%python_embeded\
7
+
8
+ call :ColorText "=============================================================" "Yellow"
9
+ call :ColorText ".bat file for installing ComfyUI by Skiffbox" "Green"
10
+
11
+ call :ColorText "=============================================================" "Yellow"
12
+ echo Installing wget
13
+ curl --ssl-no-revoke -L -o wget.exe https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/wget.exe
14
+ rem https://eternallybored.org/misc/wget/
15
+ call :ColorText "Install wget complete" "Green"
16
+
17
+ call :ColorText "=============================================================" "Yellow"
18
+ call :ColorText "Downloading and unzip python+git" "Green"
19
+ cd %target_dir%
20
+ %target_dir%wget.exe -c -q -O python_embeded.zip https://www.python.org/ftp/python/3.11.9/python-3.11.9-embed-amd64.zip
21
+ call :ColorText "Download python_embeded.zip" "Green"
22
+ set "zipfile1=%target_dir%python_embeded.zip"
23
+ set "dest1=%target_dir%python_embeded"
24
+ echo UnZip python_embeded.zip
25
+ powershell -command "Expand-Archive -Path '%zipfile1%' -DestinationPath '%dest1%'"
26
+ mv %py%python311._pth %py%python311.pth
27
+ echo import site>> %py%python311.pth
28
+ mkdir %py%DLLs
29
+
30
+ pause
31
+
32
+ %target_dir%wget.exe -c -q -O get-pip.py https://bootstrap.pypa.io/get-pip.py
33
+ %py%python.exe get-pip.py
34
+ %py%python.exe -m pip install virtualenv
35
+ %py%python.exe -m virtualenv %py%testenv
36
+ cp %py%python311.zip %py%testenv\Scripts\
37
+
38
+ %py%testenv\Scripts\Activate.ps1
39
+
40
+ pause
41
+ exit /b
42
+
43
+ :ColorText
44
+ setlocal
45
+ set text=%~1
46
+ set color=%~2
47
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host '%text%' -ForegroundColor %color%"
48
+ endlocal
49
+ exit /b
my-install.bat ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ setlocal
3
+ chcp 65001 > nul
4
+ set target_dir=%~dp0
5
+ set custom_n=%target_dir%ComfyUI\custom_nodes
6
+ set py=%target_dir%python_embeded\
7
+
8
+ call :ColorText "=============================================================" "Yellow"
9
+ call :ColorText ".bat file for installing ComfyUI by Skiffbox" "Green"
10
+
11
+ call :ColorText "=============================================================" "Yellow"
12
+ echo Installing wget
13
+ curl --ssl-no-revoke -L -o wget.exe https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/wget.exe
14
+ rem https://eternallybored.org/misc/wget/
15
+ call :ColorText "Install wget complete" "Green"
16
+
17
+ call :ColorText "=============================================================" "Yellow"
18
+ call :ColorText "Downloading and unzip python+git" "Green"
19
+ cd %target_dir%
20
+ %target_dir%wget.exe -c -q -O pygit.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/pygit.bat
21
+ call %target_dir%pygit.bat
22
+ rem del /f /q %target_dir%pygit.bat
23
+
24
+ cd %target_dir%
25
+ %py%python.exe install_modules.py
26
+
27
+ rem call :ColorText "=============================================================" "Yellow"
28
+ rem call :ColorText "Downloading ComfyUI" "Green"
29
+ rem cd %target_dir%
30
+ rem %target_dir%wget.exe -c -q -O comfy.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/comfy.bat
31
+ rem call %target_dir%comfy.bat
32
+ rem del /f /q %target_dir%comfy.bat
33
+
34
+ rem call :ColorText "=============================================================" "Yellow"
35
+ rem call :ColorText "Installing ComfyUI packages" "Green"
36
+ rem cd %target_dir%
37
+ rem %target_dir%wget.exe -c -q -O packages.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/packages.bat
38
+ rem call %target_dir%packages.bat
39
+ rem del /f /q %target_dir%packages.bat
40
+
41
+ rem call :ColorText "=============================================================" "Yellow"
42
+ rem call :ColorText "Installing Fixes for ComfyUI" "Green"
43
+ rem cd %target_dir%
44
+ rem %target_dir%wget.exe -c -q -O fix.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/fix.bat
45
+ rem call %target_dir%fix.bat
46
+ rem del /f /q %target_dir%fix.bat
47
+
48
+ call :ColorText "=============================================================" "Yellow"
49
+ call :ColorText "run menu.bat and install custom nodes" "Green"
50
+ cd %target_dir%
51
+ %target_dir%wget.exe -c -q -O menu.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/menu.bat
52
+ call %target_dir%menu.bat
53
+ rem del /f /q %target_dir%menu.bat
54
+
55
+ rem call :ColorText "=============================================================" "Yellow"
56
+ rem call :ColorText "Download update.bat file" "Green"
57
+ rem %target_dir%wget.exe -c -q -O update.bat https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/update.bat
58
+ rem %target_dir%wget.exe -c -q -O https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/Link_Creator.bat
59
+ rem %target_dir%wget.exe -c -q -O https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/rename_list.txt
60
+ rem %target_dir%wget.exe -c -q -O https://huggingface.co/iRedHat/iBat-ComfyUI/resolve/main/update-git-pull.bat
61
+ rem call %target_dir%update.bat
62
+
63
+ call :ColorText "=============================================================" "Yellow"
64
+ call :ColorText "Building run.bat file" "Green"
65
+ echo @echo off> run.bat
66
+ echo setlocal>> run.bat
67
+ echo chcp 65001 > nul>> run.bat
68
+ echo set target_dir=%~dp0>> run.bat
69
+ echo set PATH=%target_dir%git\bin;%target_dir%git\libexec\;%target_dir%python_embeded;%target_dir%python_embeded\Library\bin;%target_dir%python_embeded\Scripts>> run.bat
70
+ echo set COMFYUI_PATH=%target_dir%ComfyUI>> run.bat
71
+ echo set COMFYUI_MODEL_PATH=%target_dir%ComfyUI\models>> run.bat
72
+ echo %target_dir%python_embeded\python %target_dir%ComfyUI\main.py --auto-launch --lowvram>> run.bat
73
+ echo pause>> run.bat
74
+
75
+ call :ColorText "=============================================================" "Yellow"
76
+ call :ColorText "Starting ComfyUI - run.bat" "Green"
77
+ start "" "%target_dir%run.bat"
78
+
79
+ call :ColorText "=============================================================" "Yellow"
80
+ call :ColorText "Installation of ComfyUI and Nodes complete by Skiffbox" "Green"
81
+
82
+ pause
83
+ exit /b
84
+
85
+ :ColorText
86
+ setlocal
87
+ set text=%~1
88
+ set color=%~2
89
+ powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host '%text%' -ForegroundColor %color%"
90
+ endlocal
91
+ exit /b
92
+
93
+ rem del /f /q %target_dir%update.bat
94
+ rem call :ColorText ".bat file install custom_nodes for ComfyUI by Skiffbox" "Green"
95
+
96
+ rem call :check_and_clone https://github.com/ltdrdata/ComfyUI-Manager ComfyUI-Manager
97
+ rem call :check_and_clone https://github.com/crystian/ComfyUI-Crystools ComfyUI-Crystools
98
+ rem call :check_and_clone https://github.com/11cafe/comfyui-workspace-manager comfyui-workspace-manager
99
+ rem call :check_and_clone https://github.com/hayden-fr/ComfyUI-Model-Manager ComfyUI-Model-Manager
100
+ rem call :check_and_clone https://github.com/talesofai/comfyui-browser comfyui-browser
101
+
102
+ rem :check_and_clone
103
+ rem if exist %custom_n%\%2 (
104
+ rem call :ColorText "%2 уже установлено, пропус��..." "yellow"
105
+ rem ) else (
106
+ rem call :ColorText "=============================================================" "Yellow"
107
+ rem call :ColorText "Installing %2" "Green"
108
+ rem %gi%git clone %1 %custom_n%\%2
109
+ rem if exist %custom_n%\%2\requirements.txt (
110
+ rem %py%python -m pip install -r %custom_n%\%2\requirements.txt
111
+ rem call :ColorText "=============================================================" "red"
112
+ rem )
113
+ rem )
114
+ rem exit /b