Skip to content

Commit f21c325

Browse files
committed
Managed install: freeze pip package versions and install from custom requirements.txt
- remove some redundant dependencies - don't install trimesh/xatlas #1622 #1687 #1570
1 parent 76b4169 commit f21c325

File tree

4 files changed

+118
-4
lines changed

4 files changed

+118
-4
lines changed

ai_diffusion/server.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ async def _install_comfy(self, comfy_dir: Path, network: QNetworkAccessManager,
219219
torch_args = ["numpy<2", "torch-directml"]
220220
await _execute_process("PyTorch", self._pip_install(*torch_args), self.path, cb)
221221

222+
requirements_txt = Path(__file__).parent / "server_requirements.txt"
223+
await _execute_process("ComfyUI", self._pip_install("-r", requirements_txt), self.path, cb)
224+
222225
requirements_txt = temp_comfy_dir / "requirements.txt"
223226
await _execute_process("ComfyUI", self._pip_install("-r", requirements_txt), self.path, cb)
224227

@@ -239,10 +242,6 @@ async def _install_custom_node(
239242
await _download_cached(pkg.name, network, resource_url, resource_zip_path, cb)
240243
await _extract_archive(pkg.name, resource_zip_path, folder.parent, cb)
241244
await rename_extracted_folder(pkg.name, folder, pkg.version)
242-
243-
requirements_txt = folder / "requirements.txt"
244-
if requirements_txt.exists():
245-
await _execute_process(pkg.name, self._pip_install("-r", requirements_txt), folder, cb)
246245
cb(f"Installing {pkg.name}", f"Finished installing {pkg.name}")
247246

248247
async def _install_insightface(self, network: QNetworkAccessManager, cb: InternalCB):
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile scripts/server_requirements.in.txt --no-deps --no-annotate --universal -o ai_diffusion/server_requirements.txt
3+
addict==2.4.0
4+
aiohttp==3.11.14
5+
albumentations==2.0.5
6+
argostranslate==1.9.6
7+
av==14.2.0
8+
einops==0.8.1
9+
filelock==3.18.0
10+
ftfy==6.3.1
11+
fvcore==0.1.5.post20221221
12+
gguf==0.14.0
13+
huggingface-hub==0.29.3
14+
importlib-metadata==8.6.1
15+
kornia==0.8.0
16+
matplotlib==3.10.1
17+
mediapipe==0.10.21
18+
omegaconf==2.3.0
19+
opencv-python==4.11.0.86
20+
pillow==11.1.0
21+
psutil==7.0.0
22+
python-dateutil==2.9.0.post0
23+
pyyaml==6.0.2
24+
safetensors==0.5.3
25+
scikit-image==0.25.2
26+
scikit-learn==1.6.1
27+
scipy==1.15.2
28+
sentencepiece==0.2.0
29+
soundfile==0.13.1
30+
spandrel==0.4.1
31+
svglib==1.5.1
32+
tokenizers==0.21.1
33+
torchsde==0.2.6
34+
tqdm==4.67.1
35+
transformers==4.50.3
36+
yacs==0.1.8
37+
yapf==0.43.0
38+
yarl==1.18.3

scripts/package.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import dotenv
55
import os
6+
import subprocess
67
from markdown import markdown
78
from shutil import rmtree, copy, copytree, ignore_patterns, make_archive
89
from pathlib import Path
@@ -27,10 +28,30 @@ def convert_markdown_to_html(markdown_file: Path, html_file: Path):
2728
f.write(html)
2829

2930

31+
def update_server_requirements():
32+
subprocess.run(
33+
[
34+
"uv",
35+
"pip",
36+
"compile",
37+
"scripts/server_requirements.in",
38+
"--no-deps",
39+
"--no-annotate",
40+
"--universal",
41+
"-o",
42+
"ai_diffusion/server_requirements.txt",
43+
],
44+
cwd=root,
45+
check=True,
46+
)
47+
48+
3049
def build_package():
3150
translation.update_template()
3251
translation.update_all()
3352

53+
update_server_requirements()
54+
3455
rmtree(package_dir, ignore_errors=True)
3556
package_dir.mkdir()
3657
copy(root / "ai_diffusion.desktop", package_dir)

scripts/server_requirements.in

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Requirements for ComfyUI and custom nodes
2+
# meant as input for pinning versions with `uv pip compile`
3+
#
4+
# Removed dependencies:
5+
# - torch (depends on backend and OS, installed manually)
6+
# - numpy (directml requires an older version)
7+
# - trimesh (optional, causes problems due to xatlas dependency)
8+
# - comfyui-frontend-package (installed from ComfyUI's requirements.txt to match version)
9+
10+
# ComfyUI
11+
torchsde
12+
einops
13+
transformers>=4.28.1
14+
tokenizers>=0.13.3
15+
sentencepiece
16+
safetensors>=0.4.2
17+
aiohttp>=3.11.8
18+
yarl>=1.18.0
19+
pyyaml
20+
Pillow
21+
scipy
22+
tqdm
23+
psutil
24+
kornia>=0.7.1
25+
spandrel
26+
soundfile
27+
av
28+
29+
# comfyui_controlnet_aux
30+
importlib_metadata
31+
huggingface_hub
32+
scipy
33+
opencv-python>=4.7.0.72
34+
filelock
35+
Pillow
36+
einops
37+
pyyaml
38+
scikit-image
39+
python-dateutil
40+
mediapipe
41+
svglib
42+
fvcore
43+
yapf
44+
omegaconf
45+
ftfy
46+
addict
47+
yacs
48+
albumentations
49+
scikit-learn
50+
matplotlib
51+
52+
# ComfyUI-GGUF
53+
gguf
54+
55+
# comfyui-tooling-nodes
56+
argostranslate

0 commit comments

Comments
 (0)