Files
comfyui-nvidia/install-custom-node-deps.sh
William Gill 2cecf77981
All checks were successful
release / Build & Push Docker Image (push) Successful in 1m12s
Pin transformers <5 — comfyui_segment_anything's GroundingDINO needs it
transformers 5.0 removed BertModel.get_head_mask (it was on the legacy
4.x API). comfyui_segment_anything's GroundingDINO bertwarper.py still
calls bert_model.get_head_mask in __init__, so first inpaint crashes
with AttributeError. Pinned transformers>=4.40,<5 in two places:

  - Dockerfile: applied AFTER the custom node's requirements.txt
    install so it wins on a fresh image build.
  - install-custom-node-deps.sh entrypoint: re-applied at every
    container start so any future custom-node install (via
    ComfyUI-Manager or volume clone) that pulls a newer transformers
    transitively gets pinned back into the working range.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 15:21:21 -05:00

29 lines
1.1 KiB
Bash

#!/bin/sh
# Entrypoint wrapper. Pip-installs requirements.txt for any custom_node
# present in /opt/comfyui/custom_nodes/, then exec's the CMD.
#
# This makes the container self-healing for custom nodes that get added
# at runtime — either via ComfyUI-Manager from the web UI, or by
# git-cloning directly into the comfyui-custom-nodes volume. Pip skips
# already-satisfied requirements quickly, so the boot-time cost on
# subsequent restarts is negligible.
set -e
if [ -d /opt/comfyui/custom_nodes ]; then
for req in /opt/comfyui/custom_nodes/*/requirements.txt; do
[ -f "$req" ] || continue
echo "[entrypoint] installing $req"
pip install -q -r "$req" || echo " (install failed — continuing)"
done
fi
# Force-pin known-incompatible packages back into a working range. Some
# custom nodes bring transformers >=5 transitively, which removes
# BertModel.get_head_mask and breaks comfyui_segment_anything's
# GroundingDINO. Run last so it wins over anything the loop above
# installed.
pip install -q "transformers>=4.40,<5" || echo "[entrypoint] transformers pin failed — continuing"
exec "$@"