Allow disabling prestartup auto pip install/upgrade#2851
Open
caniko wants to merge 2 commits into
Open
Conversation
9a35c29 to
1584887
Compare
Add a `dependency_management` config key (and matching `COMFYUI_MANAGER_DEPENDENCY_MANAGEMENT` env override) so installs on externally-managed Python environments — Nix, Guix, system packages, locked-down corporate images — can disable every prestartup path that mutates the interpreter. When set to `off`: - `PIPFixer.fix_broken()` returns immediately (no torch/opencv/comfy rollback, no `comfyui-frontend-package` reinstall). - The unified dependency resolver is skipped before it tries to `uv pip install` against a read-only store. - Per-node `pip install -r requirements.txt` in `execute_lazy_install_script` is skipped. Read-only operations (`pip list`, `pip freeze`, `pip show`) still run, so the UI, inventory, and security checks keep functioning. Default is `on`, preserving today's behavior for every existing user.
Lift the on/off value parser to `manager_util.is_off_value` so the prestartup hook and the new tests share one definition, and cover the flag's contract: - default is enabled (today's behavior is preserved bit-for-bit) - PIPFixer.fix_broken short-circuits without spawning subprocess when the flag is off - PIPFixer.fix_broken still reaches subprocess when the flag is on - make_pip_cmd is not gated — read paths (`pip list`, `freeze`, `show`) the UI and security check rely on continue to work - value parser accepts off/false/0/no/disabled (case- and whitespace-insensitive) and treats unknown values as "on" so a typo doesn't silently disable installs
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
dependency_managementconfig key (with aCOMFYUI_MANAGER_DEPENDENCY_MANAGEMENTenv override) to opt out of everyprestartup path that mutates the Python interpreter, so Manager can be
used on top of an externally-managed env without screaming subprocess
errors.
Why
When ComfyUI-Manager runs on an interpreter the user doesn't own — Nix,
Guix, distro Python, locked-down corporate images — every startup ends
the same way:
The env already has the right packages pinned by whoever produced it;
Manager doesn't need to reinstall them, and on a read-only store it
can't. Today there's no clean way to tell it to stand down — it tries
pip→python -m uv→ standaloneuvand only gives up after allthree fail, which produces a noisy startup and a confused user.
What changes
When
dependency_management = off(orCOMFYUI_MANAGER_DEPENDENCY_MANAGEMENT=off):PIPFixer.fix_broken()returns immediately. No torch rollback, noopencv alignment, no
comfyuninstall, nocomfyui-frontend-packagereinstall.
prestartup_script.pyisskipped before it reaches
uv pip install.pip install -r requirements.txtinexecute_lazy_install_scriptis skipped.Read-only operations (
pip list,pip freeze,pip show) still run,so the UI inventory,
cm-clilistings, andsecurity_checkkeepworking. User-initiated installs via
cm-cli installand the UI installbuttons are deliberately not gated — those are explicit actions and
shouldn't be silently swallowed.
The default is
on, which preserves today's behavior bit-for-bit. Noexisting user is affected unless they flip the switch.
Configuration
config.ini:Or, without touching the config:
The env var wins over the config key. Accepted "off" values are
off,false,0,no,disabled(case-insensitive); anything else istreated as on.
Test plan
dependency_management = off— ComfyUI starts with--enable-manageron a Nix-managed env without subprocess errorsCOMFYUI_MANAGER_DEPENDENCY_MANAGEMENT=offoverridesdependency_management = onpip list/freeze/showpaths still work (UI inventory,security check)
cm-cli install <node>still installs (CLI not gated)Notes
Branched off
manager-v4(4.2.1). +46/-1 across two files:comfyui_manager/common/manager_util.pyandcomfyui_manager/prestartup_script.py.