Skip to content

ComfyUI container fails to start: pip missing from venv prevents requirements.txt installation #200

@Daemonrat

Description

@Daemonrat

Environment

  • Harbor version: Latest (as of November 2025)
  • Host OS: Arch Linux
  • Service: ComfyUI
  • GPU: Tesla P40 (24GB VRAM)

Problem Summary

The ComfyUI container enters a crash loop on startup with ModuleNotFoundError: No module named 'av'. The issue is NOT that the dependency is missing from requirements.txt, but that pip is not available in the Python virtual environment at /opt/environments/python/comfyui, preventing automatic installation of requirements during container startup.

Error Logs

harbor.comfyui  | [ComfyUI-Manager] Neither python -m pip nor uv are available. Cannot proceed with package operations.
harbor.comfyui  | Failed to execute startup-script: /workspace/ComfyUI/custom_nodes/ComfyUI-Manager/prestartup_script.py / Neither pip nor uv are available for package management
harbor.comfyui  | 
harbor.comfyui  | Traceback (most recent call last):
harbor.comfyui  |   File "/workspace/ComfyUI/comfy_api/latest/_input/video_types.py", line 5, in <module>
harbor.comfyui  |     import av
harbor.comfyui  | ModuleNotFoundError: No module named 'av'

Reproduction Steps

  1. harbor up comfyui
  2. Container crashes immediately
  3. harbor logs comfyui shows the above errors
  4. Container enters FATAL state after multiple restart attempts

Investigation & Findings

Verified the requirements.txt includes av

av>=14.1.0

is present in /workspace/ComfyUI/requirements.txt (confirmed by inspecting the file inside the container).

Manual installation works

When I manually fix the issue inside the container:

harbor exec comfyui bash
/opt/environments/python/comfyui/bin/python -m ensurepip --upgrade
/opt/environments/python/comfyui/bin/pip install -r /workspace/ComfyUI/requirements.txt
cd /workspace/ComfyUI
/opt/environments/python/comfyui/bin/python main.py

ComfyUI starts successfully without errors.

The issue does NOT persist

After exiting and running harbor restart comfyui, the container crashes again with the same error. This confirms that pip installations are not persisting because pip itself is missing from the venv during container initialization.

Root Cause

The virtual environment at /opt/environments/python/comfyui was created without pip installed (likely using python -m venv --without-pip or a minimal venv tool like uv). This causes:

  1. ComfyUI's requirements.txt installation to fail silently or not run at all
  2. ComfyUI-Manager's prestartup script to fail with the "Neither python -m pip nor uv are available" error
  3. The av module (and potentially other dependencies) to never get installed

Proposed Solution

The Harbor ComfyUI container image needs to ensure pip is installed in the venv during image build or container initialization. Add to the container's entrypoint or Dockerfile:

/opt/environments/python/comfyui/bin/python -m ensurepip --upgrade

This should run before ComfyUI's main.py is executed, ensuring that:

  1. pip is available for requirements.txt installation
  2. ComfyUI-Manager's prestartup scripts can function properly
  3. All dependencies (including the recently-added av>=14.1.0 for video support) are installed automatically

Workaround

Users can temporarily fix this by execing into the container and running:

/opt/environments/python/comfyui/bin/python -m ensurepip --upgrade
/opt/environments/python/comfyui/bin/pip install -r /workspace/ComfyUI/requirements.txt

However, this must be repeated after every container restart.

Additional Context

This issue likely affects recent ComfyUI updates that added av>=14.1.0 as a core dependency for video processing functionality (see Comfy-Org/ComfyUI#9999 and #7869). Older ComfyUI versions may not have triggered this issue if they had fewer dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions