rishi desai commited on
Commit
8cd2170
ยท
1 Parent(s): ae826ca

install script for custom nodes

Browse files
Files changed (3) hide show
  1. .gitignore +2 -0
  2. install.py +34 -114
  3. run.py +16 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ venv
2
+ .env
install.py CHANGED
@@ -1,8 +1,9 @@
1
  import os
2
 
3
  # Define paths
4
- BASE_PATH = "./ComfyUI"
5
- MODEL_PATH = os.path.join(BASE_PATH, "models")
 
6
  CACHE_PATH = "/workspace/huggingface_cache"
7
 
8
  os.environ["HF_HOME"] = CACHE_PATH
@@ -19,15 +20,15 @@ def run_command(command):
19
  exit(1) # Exit on failure
20
 
21
 
22
- def install_dependencies():
23
- """Install system dependencies and Python packages."""
24
- print("๐Ÿ“ฆ Installing dependencies...")
25
- # run_command("apt-get update && apt-get install -y git wget curl libgl1-mesa-glx libglib2.0-0 tmux emacs git-lfs")
26
- run_command("pip install --upgrade pip")
27
- run_command("pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124")
28
- run_command("pip install xformers --index-url https://download.pytorch.org/whl/cu124")
29
- run_command("pip install -r requirements.txt")
30
- print("โœ… Dependencies installed.")
31
 
32
 
33
  def manage_git_repo(repo_url, install_path, requirements=False, submodules=False):
@@ -39,6 +40,9 @@ def manage_git_repo(repo_url, install_path, requirements=False, submodules=False
39
  requirements: Whether to install requirements.txt
40
  submodules: Whether to update git submodules
41
  """
 
 
 
42
  if not os.path.exists(install_path) or not os.path.isdir(install_path) or not os.path.exists(
43
  os.path.join(install_path, ".git")):
44
  print(f"๐Ÿ“‚ Cloning {os.path.basename(install_path)}...")
@@ -57,17 +61,19 @@ def manage_git_repo(repo_url, install_path, requirements=False, submodules=False
57
  run_command("python -m pip install -r requirements.txt")
58
 
59
  print(f"โœ… {os.path.basename(install_path)} installed and updated.")
 
 
 
60
 
61
 
62
  def install_comfyui():
63
  """Clone and set up ComfyUI if not already installed."""
64
  manage_git_repo(
65
  "https://github.com/comfyanonymous/ComfyUI.git",
66
- BASE_PATH,
67
  requirements=True
68
  )
69
 
70
-
71
  def download_huggingface_models():
72
  """Download required models from Hugging Face."""
73
  from huggingface_hub import hf_hub_download
@@ -145,133 +151,47 @@ def download_and_extract_antelopev2():
145
 
146
  def install_custom_nodes():
147
  """Install all custom nodes for ComfyUI."""
148
- # List of custom nodes to install via comfy node install
149
- custom_nodes = [
150
- "comfyui_essentials",
151
- "comfyui-detail-daemon",
152
- "comfyui-advancedliveportrait",
153
- "comfyui-impact-pack",
154
- "comfyui-custom-scripts",
155
- "rgthree-comfy",
156
- "comfyui-easy-use",
157
- "comfyui-florence2",
158
- "comfyui-kjnodes",
159
- "cg-use-everywhere",
160
- "comfyui-impact-subpack",
161
- "pulid_comfyui",
162
- "comfyui_pulid_flux_ll",
163
- "comfyui_birefnet_ll",
164
- "comfyui_controlnet_aux"
165
- ]
166
-
167
- os.chdir(BASE_PATH)
168
- # First update all existing nodes
169
- run_command("comfy node update all")
170
-
171
- # Then install any missing nodes
172
- for node in custom_nodes:
173
- run_command(f"comfy node install {node}")
174
 
175
- print("โœ… Installed and updated all ComfyUI registry nodes.")
176
-
177
- # List of custom nodes to install from git
178
  custom_nodes_git = [
179
  {
180
- "repo": "https://github.com/WASasquatch/was-node-suite-comfyui.git",
181
- "name": "was-node-suite-comfyui",
182
  "requirements": True
183
  },
184
  {
185
- "repo": "https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git",
186
- "name": "ComfyUI_UltimateSDUpscale",
187
- "submodules": True
188
- },
189
- {
190
- "repo": "https://github.com/huanngzh/ComfyUI-MVAdapter",
191
- "name": "ComfyUI-MVAdapter",
192
- "requirements": True
193
- },
194
- {
195
- "repo": "https://github.com/sipie800/ComfyUI-PuLID-Flux-Enhanced.git",
196
- "name": "ComfyUI-PuLID-Flux-Enhanced",
197
- "requirements": True
198
- },
199
- {
200
- "repo": "https://github.com/liusida/ComfyUI-AutoCropFaces.git",
201
- "name": "ComfyUI-AutoCropFaces",
202
- "submodules": True
203
- },
204
- {
205
- "repo": "https://github.com/giriss/comfy-image-saver.git",
206
- "name": "comfy-image-saver",
207
  "requirements": True
208
  },
209
  {
210
- "repo": "https://github.com/spacepxl/ComfyUI-Image-Filters.git",
211
- "name": "ComfyUI-Image-Filters",
212
  "requirements": True
213
  },
214
- {
215
- "repo": "https://github.com/pydn/ComfyUI-to-Python-Extension.git",
216
- "name": "ComfyUI-to-Python-Extension",
217
- "requirements": True
218
- },
219
- {
220
- "repo": "https://github.com/Limitex/ComfyUI-Diffusers.git",
221
- "name": "ComfyUI-Diffusers",
222
- "requirements": True,
223
- "post_install": [
224
- "git clone https://github.com/cumulo-autumn/StreamDiffusion.git",
225
- "python -m streamdiffusion.tools.install-tensorrt"
226
- ]
227
- },
228
- {
229
- "repo": "https://github.com/Vaibhavs10/ComfyUI-DDUF.git",
230
- "name": "ComfyUI-DDUF",
231
- "requirements": True
232
- },
233
- {
234
- "repo": "https://github.com/Chaoses-Ib/ComfyScript.git",
235
- "name": "ComfyScript",
236
- "post_install": [
237
- "python -m pip install -e \".[default]\""
238
- ]
239
  }
240
  ]
241
 
242
- # Install nodes from git
243
- os.chdir(os.path.join(BASE_PATH, "custom_nodes"))
244
  for node in custom_nodes_git:
245
  repo_name = node["name"]
246
- repo_path = os.path.join(BASE_PATH, "custom_nodes", repo_name)
247
  manage_git_repo(
248
  node["repo"],
249
  repo_path,
250
  requirements=node.get("requirements", False),
251
  submodules=node.get("submodules", False)
252
  )
 
253
 
254
- # Handle any post-install commands
255
- if "post_install" in node:
256
- os.chdir(repo_path)
257
- for command in node["post_install"]:
258
- run_command(command)
259
-
260
-
261
- def install_comfyui_manager():
262
- """Install ComfyUI Manager."""
263
- manager_path = os.path.join(BASE_PATH, "custom_nodes", "ComfyUI-Manager")
264
- manage_git_repo(
265
- "https://github.com/ltdrdata/ComfyUI-Manager",
266
- manager_path,
267
- requirements=True
268
- )
269
 
270
 
271
  if __name__ == "__main__":
272
  # install_dependencies()
273
- install_comfyui()
274
- install_comfyui_manager()
275
  # download_huggingface_models()
276
- # install_custom_nodes()
277
  print("๐ŸŽ‰ Setup Complete! Run `run.py` to start ComfyUI.")
 
1
  import os
2
 
3
  # Define paths
4
+ BASE_PATH = "./"
5
+ COMFYUI_PATH = os.path.join(BASE_PATH, "ComfyUI")
6
+ MODEL_PATH = os.path.join(COMFYUI_PATH, "models")
7
  CACHE_PATH = "/workspace/huggingface_cache"
8
 
9
  os.environ["HF_HOME"] = CACHE_PATH
 
20
  exit(1) # Exit on failure
21
 
22
 
23
+ # def install_dependencies():
24
+ # """Install system dependencies and Python packages."""
25
+ # print("๐Ÿ“ฆ Installing dependencies...")
26
+ # # run_command("apt-get update && apt-get install -y git wget curl libgl1-mesa-glx libglib2.0-0 tmux emacs git-lfs")
27
+ # run_command("pip install --upgrade pip")
28
+ # run_command("pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124")
29
+ # run_command("pip install xformers --index-url https://download.pytorch.org/whl/cu124")
30
+ # # run_command("pip install -r requirements.txt")
31
+ # print("โœ… Dependencies installed.")
32
 
33
 
34
  def manage_git_repo(repo_url, install_path, requirements=False, submodules=False):
 
40
  requirements: Whether to install requirements.txt
41
  submodules: Whether to update git submodules
42
  """
43
+ # Save the original directory
44
+ original_dir = os.getcwd()
45
+
46
  if not os.path.exists(install_path) or not os.path.isdir(install_path) or not os.path.exists(
47
  os.path.join(install_path, ".git")):
48
  print(f"๐Ÿ“‚ Cloning {os.path.basename(install_path)}...")
 
61
  run_command("python -m pip install -r requirements.txt")
62
 
63
  print(f"โœ… {os.path.basename(install_path)} installed and updated.")
64
+
65
+ # Change back to the original directory
66
+ os.chdir(original_dir)
67
 
68
 
69
  def install_comfyui():
70
  """Clone and set up ComfyUI if not already installed."""
71
  manage_git_repo(
72
  "https://github.com/comfyanonymous/ComfyUI.git",
73
+ COMFYUI_PATH,
74
  requirements=True
75
  )
76
 
 
77
  def download_huggingface_models():
78
  """Download required models from Hugging Face."""
79
  from huggingface_hub import hf_hub_download
 
151
 
152
  def install_custom_nodes():
153
  """Install all custom nodes for ComfyUI."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
 
 
 
155
  custom_nodes_git = [
156
  {
157
+ "repo": "https://github.com/ltdrdata/ComfyUI-Manager",
158
+ "name": "ComfyUI-Manager",
159
  "requirements": True
160
  },
161
  {
162
+ "repo": "https://github.com/balazik/ComfyUI-PuLID-Flux",
163
+ "name": "ComfyUI-PuLID-Flux",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  "requirements": True
165
  },
166
  {
167
+ "repo": "https://github.com/rgthree/rgthree-comfy",
168
+ "name": "rgthree-comfy",
169
  "requirements": True
170
  },
171
+ { # we already have insightface so don't need requirements (for dlib)
172
+ "repo": "https://github.com/cubiq/ComfyUI_FaceAnalysis",
173
+ "name": "ComfyUI_FaceAnalysis",
174
+ "requirements": False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
  ]
177
 
 
 
178
  for node in custom_nodes_git:
179
  repo_name = node["name"]
180
+ repo_path = os.path.join(COMFYUI_PATH, "custom_nodes", repo_name)
181
  manage_git_repo(
182
  node["repo"],
183
  repo_path,
184
  requirements=node.get("requirements", False),
185
  submodules=node.get("submodules", False)
186
  )
187
+ print(f"โœ… {repo_name} installed and updated.")
188
 
189
+ print("โœ… Installed and updated all ComfyUI nodes.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
 
192
  if __name__ == "__main__":
193
  # install_dependencies()
194
+ # install_comfyui()
 
195
  # download_huggingface_models()
196
+ install_custom_nodes()
197
  print("๐ŸŽ‰ Setup Complete! Run `run.py` to start ComfyUI.")
run.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+
4
+ BASE_PATH = "./ComfyUI"
5
+ PORT = 8000
6
+
7
+ def run_comfyui():
8
+ """Launch ComfyUI with external access."""
9
+ os.chdir(BASE_PATH)
10
+ print(f"๐Ÿš€ Launching ComfyUI on port {PORT}...")
11
+
12
+ subprocess.run(f"python main.py --listen 0.0.0.0 --port {PORT} --disable-auto-launch", shell=True)
13
+
14
+ if __name__ == "__main__":
15
+ run_comfyui()
16
+ print(f"Now run port-forwarding\nssh -L {PORT}:localhost:{PORT} root@[IP address] -p [RUNPOD_PORT] -i ~/.ssh/id_runpod")