mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-04-26 02:12:31 +08:00
fix(entrypoint): install only root requirements.txt and install.py per node; remove wildcards and recursion
- Replace wildcard/recursive requirements scanning with a per-node loop that installs only each node’s top-level requirements.txt and runs install.py when present, aligning behavior with ComfyUI-Manager and preventing unintended subfolder or variant requirements from being applied. - Drop automatic pyproject.toml/setup.py installs to avoid packaging nodes unnecessarily; ComfyUI loads nodes from custom_nodes directly. - Keep user-level pip and permissions hardening so ComfyUI-Manager can later manage deps without permission errors.
This commit is contained in:
parent
16652fb90a
commit
a632e1c5be
@ -319,7 +319,6 @@ export PIP_PREFER_BINARY=1
|
|||||||
# Abort early if no compatible NVIDIA GPU (>= sm_75) is present
|
# Abort early if no compatible NVIDIA GPU (>= sm_75) is present
|
||||||
if ! gpu_is_compatible; then
|
if ! gpu_is_compatible; then
|
||||||
log "No compatible NVIDIA GPU detected (compute capability 7.5+ required). Shutting down container."
|
log "No compatible NVIDIA GPU detected (compute capability 7.5+ required). Shutting down container."
|
||||||
# Exit 0 to avoid restart loops in some runtimes
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -342,25 +341,24 @@ if [ ! -f "$FIRST_RUN_FLAG" ] || [ "${COMFY_FORCE_INSTALL:-0}" = "1" ]; then
|
|||||||
if [ "${COMFY_AUTO_INSTALL:-1}" = "1" ]; then
|
if [ "${COMFY_AUTO_INSTALL:-1}" = "1" ]; then
|
||||||
log "First run or forced; installing custom node dependencies..."
|
log "First run or forced; installing custom node dependencies..."
|
||||||
|
|
||||||
# 1) Install requirements files (Manager-like behavior)
|
# Manager-like behavior: per-node, top-level requirements.txt only, plus optional install.py;
|
||||||
while IFS= read -r -d '' req; do
|
shopt -s nullglob
|
||||||
log "python -m pip install --user --upgrade --upgrade-strategy only-if-needed -r $req"
|
for d in "$CUSTOM_NODES_DIR"/*; do
|
||||||
python -m pip install --no-cache-dir --user --upgrade --upgrade-strategy only-if-needed -r "$req" || true
|
[ -d "$d" ] || continue
|
||||||
done < <(find "$CUSTOM_NODES_DIR" -maxdepth 3 -type f \( -iname 'requirements.txt' -o -iname 'requirements-*.txt' -o -path '*/requirements/*.txt' \) -print0)
|
base="$(basename "$d")"
|
||||||
|
[ "$base" = "ComfyUI-Manager" ] && continue
|
||||||
|
|
||||||
# 2) Install from pyproject (editable build avoided to mimic Manager’s typical install)
|
if [ -f "$d/requirements.txt" ]; then
|
||||||
while IFS= read -r -d '' pjt; do
|
log "Installing requirements for node: $base"
|
||||||
d="$(dirname "$pjt")"
|
python -m pip install --no-cache-dir --user --upgrade --upgrade-strategy only-if-needed -r "$d/requirements.txt" || true
|
||||||
log "python -m pip install --user . in $d"
|
fi
|
||||||
(cd "$d" && python -m pip install --no-cache-dir --user .) || true
|
|
||||||
done < <(find "$CUSTOM_NODES_DIR" -maxdepth 2 -type f -iname 'pyproject.toml' -not -path '*/ComfyUI-Manager/*' -print0)
|
|
||||||
|
|
||||||
# 3) Run node-provided install.py if present (Manager runs install scripts; mirror that)
|
if [ -f "$d/install.py" ]; then
|
||||||
while IFS= read -r -d '' inst; do
|
log "Running install.py for node: $base"
|
||||||
d="$(dirname "$inst")"
|
(cd "$d" && python "install.py") || true
|
||||||
log "Running node install script: $inst"
|
fi
|
||||||
(cd "$d" && python "$inst") || true
|
done
|
||||||
done < <(find "$CUSTOM_NODES_DIR" -maxdepth 2 -type f -iname 'install.py' -not -path '*/ComfyUI-Manager/*' -print0)
|
shopt -u nullglob
|
||||||
|
|
||||||
python -m pip check || true
|
python -m pip check || true
|
||||||
else
|
else
|
||||||
@ -373,12 +371,15 @@ fi
|
|||||||
|
|
||||||
# --- launch ComfyUI ---
|
# --- launch ComfyUI ---
|
||||||
COMFYUI_ARGS=""
|
COMFYUI_ARGS=""
|
||||||
if [ "${FORCE_SAGE_ATTENTION:-0}" = "1" ]; then
|
if [ "${FORCE_SAGE_ATTENTION:-0}" = "1" ] && test_sage_attention; then
|
||||||
if test_sage_attention; then COMFYUI_ARGS="--use-sage-attention"; log "Starting ComfyUI with SageAttention (FORCE_SAGE_ATTENTION=1)"
|
COMFYUI_ARGS="--use-sage-attention"
|
||||||
else log "WARNING: FORCE_SAGE_ATTENTION=1 but import failed; starting without"; fi
|
log "Starting ComfyUI with SageAttention (FORCE_SAGE_ATTENTION=1)"
|
||||||
else
|
else
|
||||||
if [ "${SAGE_ATTENTION_AVAILABLE:-0}" = "1" ]; then log "SageAttention is built; set FORCE_SAGE_ATTENTION=1 to enable"
|
if [ "${SAGE_ATTENTION_AVAILABLE:-0}" = "1" ]; then
|
||||||
else log "SageAttention not available; starting without it"; fi
|
log "SageAttention is built; set FORCE_SAGE_ATTENTION=1 to enable"
|
||||||
|
else
|
||||||
|
log "SageAttention not available; starting without it"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$BASE_DIR"
|
cd "$BASE_DIR"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user