Skip to content

[BUG]: Custom nodes that declare pip dependencies fails to execute #237

Description

@Feoni4

Describe the bug

Custom nodes that declare pip dependencies (e.g. comfyui-videohelpersuite, which requires opencv-python and imageio-ffmpeg) never register in ComfyUI when installed via comfy-node-install in a custom Dockerfile built on runpod/worker-comfyui:5.8.6-base. At runtime the worker fails with Node 'VHS Video Combine' not found. The custom node may not be installed. — the underlying cause is ModuleNotFoundError: No module named 'cv2' while ComfyUI imports the node.

Root cause: a venv mismatch.

  • start.sh launches ComfyUI with python -u /comfyui/main.pyPATH="/opt/venv/bin:${PATH}" makes this resolve to /opt/venv/bin/python.
  • comfy-cli's resolve_workspace_python() (used by comfy node install / cm_cli) picks VIRTUAL_ENV if set, otherwise /comfyui/.venv (the workspace venv). The base image sets PATH but not VIRTUAL_ENV.
  • So comfy-node-install installs the custom node's pip deps into /comfyui/.venv, which is invisible to the /opt/venv interpreter that actually runs ComfyUI. The node import fails, ComfyUI never registers VHS_VideoCombine, and the workflow errors with missing_node_type.

The base image already solves this for its own deps by mirroring everything into /opt/venv (the DR-1170 comment in the base Dockerfile) via a for r in /comfyui/custom_nodes/*/requirements.txt loop — but that loop runs before user custom nodes are installed, so it does not cover nodes added later by a downstream Dockerfile.

Repro MVP (Minimal Viable Procedure)

FROM runpod/worker-comfyui:5.8.6-base
RUN comfy-node-install comfyui-videohelpersuite video-output-bridge
  1. Build and deploy this image to a RunPod serverless endpoint.
  2. Submit any workflow containing a VHS_VideoCombine node (or any node from a custom node package with pip deps).
  3. Observe the job fail with:
{"error": {"type": "missing_node_type",
  "message": "Node 'VHS Video Combine' not found. The custom node may not be installed."}}

ComfyUI startup log (worker side):

[VideoHelperSuite] - WARNING - Failed to import imageio_ffmpeg
  File "/comfyui/custom_nodes/comfyui-videohelpersuite/videohelpersuite/load_video_nodes.py", line 6, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

Build log confirms the node installs successfully but deps land in the wrong venv:

Using Python 3.12.3 environment at: /comfyui/.venv
+ opencv-python==5.0.0.93
+ imageio-ffmpeg==0.6.0
1/2 [INSTALLED] comfyui-videohelpersuite                          [1.7.9]
2/2 [INSTALLED] video-output-bridge                               [0.2.6]

Expected behavior

comfy-node-install should install a custom node's pip dependencies into the same Python environment ComfyUI runs from (/opt/venv), so the node registers and its classes (VHS_VideoCombine, etc.) appear in /object_info. Alternatively, start.sh should launch ComfyUI from /comfyui/.venv, or the base image should export VIRTUAL_ENV consistently with the launch interpreter.

Workaround (verified)

After comfy-node-install, install the node requirements into the launch venv, mirroring the base image's own dep loop:

FROM runpod/worker-comfyui:5.8.6-base
RUN comfy-node-install comfyui-videohelpersuite video-output-bridge
RUN uv pip install -r /comfyui/requirements.txt \
    && for r in /comfyui/custom_nodes/*/requirements.txt; do \
         [ -f "$r" ] && uv pip install -r "$r" || true; \
       done \
    && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0"

Screenshots

(Use the two log excerpts above — they are the full evidence. No screenshots available; logs provided instead.)

Versions (please complete the following information):

  • Docker version: RunPod serverless build (buildx / OCI export); not a local Docker install
  • ComfyUI version: 0.29.0 (from ARG COMFYUI_VERSION=0.29.0 in the 5.8.6 base image Dockerfile)
  • Host OS: Linux (nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04), RunPod serverless
  • worker-comfyui image: runpod/worker-comfyui:5.8.6-base
  • Custom nodes: comfyui-videohelpersuite 1.7.9, video-output-bridge 0.2.6 (Comfy Registry)

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions