Skip to content

Updater

updater

ComfyUI Update System.

Migrated to uv — no raw pip. Handles: - ComfyUI core update (git pull) - Custom nodes update via manifest - Python dependencies update - Triton / SageAttention re-install

update_comfyui_core(comfy_path, log)

Update ComfyUI core via git pull.

Source code in umeairt_installer/installer/updater.py
def update_comfyui_core(comfy_path: Path, log: InstallerLogger) -> None:
    """Update ComfyUI core via git pull."""
    log.step("Updating ComfyUI Core")

    if not comfy_path.exists():
        log.error("ComfyUI directory not found!")
        return

    log.item("Pulling latest changes...")
    try:
        run_and_log("git", ["-C", str(comfy_path), "pull", "--ff-only"])
        log.sub("ComfyUI updated.", style="success")
    except CommandError:
        log.warning("Git pull failed. You may have local changes.", level=2)
        log.info("Try: git -C ComfyUI stash && git -C ComfyUI pull")

update_custom_nodes(python_exe, comfy_path, install_path, log, *, node_tier='full')

Update bundled custom nodes. User-installed nodes are NEVER touched.

Merges new nodes from the source manifest (additive-only) so that user customizations are preserved while newly added nodes are picked up on every update.

Source code in umeairt_installer/installer/updater.py
def update_custom_nodes(
    python_exe: Path,
    comfy_path: Path,
    install_path: Path,
    log: InstallerLogger,
    *,
    node_tier: str = "full",
) -> None:
    """Update bundled custom nodes. User-installed nodes are NEVER touched.

    Merges new nodes from the source manifest (additive-only) so that
    user customizations are preserved while newly added nodes are
    picked up on every update.
    """

    from umeairt_installer.installer.environment import find_source_scripts
    from umeairt_installer.installer.nodes import load_manifest, update_all_nodes

    scripts_dir = install_path / "scripts"
    manifest_path = scripts_dir / "custom_nodes.json"

    # Merge new nodes from source (additive-only — never overwrites user changes)
    source_dir = find_source_scripts()
    if source_dir:
        source_manifest = source_dir / "custom_nodes.json"
        if source_manifest.exists():
            scripts_dir.mkdir(parents=True, exist_ok=True)
            added = _merge_node_manifests(source_manifest, manifest_path, log)
            if added > 0:
                log.item(f"custom_nodes.json: {added} new node(s) added from source.", style="cyan")
            else:
                log.sub("custom_nodes.json is up to date.", style="success")

    if not manifest_path.exists():
        log.skip_step("Custom Nodes — manifest not found")
        return

    custom_nodes_dir = comfy_path / "custom_nodes"
    manifest = load_manifest(manifest_path)

    # Filter by tier so only the selected bundle is installed
    from umeairt_installer.installer.nodes import filter_by_tier
    manifest = filter_by_tier(manifest, node_tier)

    update_all_nodes(manifest, custom_nodes_dir, python_exe, log)

    # Provision nunchaku_versions.json during updates as well
    # (Handles Docker environments where nodes are skipped during initial build)
    nunchaku_src = scripts_dir / "nunchaku_versions.json"
    if not nunchaku_src.exists() and source_dir:
        nunchaku_src = source_dir / "nunchaku_versions.json"

    nunchaku_dst = custom_nodes_dir / "ComfyUI-nunchaku" / "nunchaku_versions.json"
    if nunchaku_src.exists() and nunchaku_dst.parent.exists():
        import shutil
        shutil.copy2(nunchaku_src, nunchaku_dst)
        log.sub("  nunchaku_versions.json provisioned.", style="success")

    # Ensure ComfyUI-Manager uses uv (mirrors PS installer's Set-ManagerUseUv)
    from umeairt_installer.installer.dependencies import configure_manager_uv
    configure_manager_uv(install_path, log)

update_dependencies(python_exe, comfy_path, install_path, log)

Update Python dependencies via uv.

Source code in umeairt_installer/installer/updater.py
def update_dependencies(
    python_exe: Path,
    comfy_path: Path,
    install_path: Path,
    log: InstallerLogger,
) -> None:
    """Update Python dependencies via uv."""
    log.step("Updating Python Dependencies")

    deps_file = install_path / "scripts" / "dependencies.json"
    if not deps_file.exists():
        log.warning("dependencies.json not found. Skipping.", level=1)
        return

    deps = load_dependencies(deps_file)

    # Update ComfyUI requirements — filter torch packages to avoid PyPI
    # overwriting the CUDA versions with CPU/generic builds.
    from umeairt_installer.installer.dependencies import _filter_torch_from_requirements

    req_file = comfy_path / deps.pip_packages.comfyui_requirements
    if req_file.exists():
        log.item("Updating ComfyUI requirements...")
        filtered = _filter_torch_from_requirements(req_file)
        # Filtering torch out of the file is not enough: `--upgrade` also
        # upgrades *dependencies* of the listed packages, and several depend
        # on torch — uv then pulls the latest torch from PyPI, which is a
        # CPU-only build on Windows. Pin the installed GPU stack.
        constraints = _write_gpu_stack_constraints(python_exe, install_path / "scripts", log)
        uv_install(python_exe, requirements=filtered, constraints=constraints, upgrade=True, timeout=1800)

        # Built-in ComfyUI-Manager: installed on update too, so existing
        # installs move off the legacy custom-node clone.
        from umeairt_installer.installer.dependencies import install_core_manager

        install_core_manager(python_exe, comfy_path, log, constraints=constraints, upgrade=True)

    # The profile chosen at install time decides the torch version, whether
    # nunchaku wheels apply, and whether SageAttention is used.
    torch_profile = UserSettings.load(install_path).torch_profile

    # Detect the backend of the *installed* torch build (used by standard
    # packages, wheels, and the optional torch update).
    cuda_tag = _resolve_update_cuda_tag(python_exe, log)

    # Install/update standard packages (insightface, facexlib, etc.)
    from umeairt_installer.installer.dependencies import install_python_packages, install_wheels
    install_python_packages(python_exe, deps, log, cuda_tag=cuda_tag)

    # Install/update wheel packages (nunchaku) — classic profile only: the
    # nunchaku wheels are built against the classic torch version.
    if torch_profile == TorchProfile.MODERN:
        log.sub("Skipping pre-built wheels (modern profile — no nunchaku).", style="cyan")
    else:
        install_wheels(python_exe, install_path, deps, log, cuda_tag=cuda_tag)

    # Update torch
    if cuda_tag is None:
        log.sub("PyTorch backend unknown — skipping the PyTorch update.", style="dim")
    elif confirm("Update PyTorch? (Only if there's a new CUDA version)"):
        torch_cfg = deps.pip_packages.get_torch(cuda_tag, profile=torch_profile)
        if torch_cfg:
            torch_pkgs = torch_cfg.packages.split()
            log.item(f"Updating PyTorch [{cuda_tag}, {torch_profile}]...")
            uv_install(
                python_exe,
                torch_pkgs,
                index_url=torch_cfg.index_url,
                upgrade=True,
            )
        else:
            log.warning(f"No PyTorch config for '{cuda_tag}'. Skipping torch update.", level=1)

    _repair_unmet_requirements(python_exe, install_path, log)

run_update(install_path, *, verbose=False, node_tier='full', gpu_only=False)

Run the full update process.

Parameters:

Name Type Description Default
install_path Path

Root installation directory.

required
verbose bool

Show detailed subprocess output.

False
node_tier str

Custom nodes bundle tier — 'minimal', 'umeairt', or 'full'.

'full'
gpu_only bool

If True, skip everything except GPU optimizations. Used when only the GPU changed between pod restarts.

False
Source code in umeairt_installer/installer/updater.py
def run_update(install_path: Path, *, verbose: bool = False, node_tier: str = "full", gpu_only: bool = False) -> None:
    """
    Run the full update process.

    Args:
        install_path: Root installation directory.
        verbose: Show detailed subprocess output.
        node_tier: Custom nodes bundle tier — 'minimal', 'umeairt', or 'full'.
        gpu_only: If ``True``, skip everything except GPU optimizations.
            Used when only the GPU changed between pod restarts.
    """
    total = 3 if gpu_only else 6
    log = setup_logger(
        log_file=install_path / "logs" / "update_log.txt",
        total_steps=total,
        verbose=verbose,
    )
    log.banner("UmeAiRT", "ComfyUI — Updater", __version__)

    comfy_path = install_path / "ComfyUI"
    scripts_dir = install_path / "scripts"

    # Detect python executable
    python_exe = _detect_python(scripts_dir, log)

    if gpu_only:
        # GPU-only mode: skip git pull, nodes, deps, and model scan.
        # Only reinstall GPU optimizations (SageAttention, Triton, etc.)
        log.step("GPU Optimizations (GPU change detected)")
        log.item("Reinstalling GPU-specific packages for new hardware...", style="cyan")

        # Uninstall old GPU packages first so they get cleanly replaced
        _uninstall_gpu_packages(python_exe, log)

        _install_optimizations(python_exe, comfy_path, install_path, log)

        log.step("GPU Optimization Complete!")
        log.success("GPU packages reinstalled for new hardware.", level=1)
        return

    # --- Full update mode ---
    # Run update steps
    update_comfyui_core(comfy_path, log)
    update_custom_nodes(python_exe, comfy_path, install_path, log, node_tier=node_tier)
    update_dependencies(python_exe, comfy_path, install_path, log)

    # Rewrite UmeAiRT-Manager so older installs switch to `python -m` (an
    # .exe launcher cannot be replaced while running, which blocks the
    # installer self-update).
    from umeairt_installer.installer.finalize import add_manager_flag_to_launchers, write_manager_script
    try:
        write_manager_script(install_path, log)
    except OSError as e:
        log.warning(f"Could not refresh UmeAiRT-Manager: {e}", level=2)
    try:
        add_manager_flag_to_launchers(install_path, log)
    except OSError as e:
        log.warning(f"Could not update the launchers: {e}", level=2)

    # Model security scan (non-blocking)
    _scan_models_warning(install_path, log)

    # Install/update GPU optimizations (SageAttention, Triton, Flash-Attn)
    _install_optimizations(python_exe, comfy_path, install_path, log)

    log.step("Update Complete!")
    log.success("All components have been updated.", level=1)