Skip to content

Finalize

finalize

Installation finalization — Steps 11-12.

Post-install tasks that wrap up the installation:

  • CLI (Step 11): installs umeairt-comfyui-installer into the venv so the generated UmeAiRT-Manager script can launch the TUI.
  • Settings (Step 11): copies custom ComfyUI UI settings from the local scripts/comfy.settings.json.
  • Launchers (Step 11): generates .bat / .sh launcher and tool scripts.
  • Models (Step 12): offers interactive model pack downloads from model_manifest.json.

install_cli_in_environment(python_exe, log)

Install the umeairt-comfyui-installer CLI into the venv.

Required for generated tool scripts (UmeAiRT-Manager.bat…).

The CLI is installed as a regular (non-editable) package: an editable install linked the environment to the bootstrap's clone in %TEMP%, so cleaning the temp folder broke the Manager. From a source checkout the checkout is built and installed; from an installed wheel (no pyproject.toml next to the package) the same version is installed from PyPI. update later upgrades it in place (see self_update).

Parameters:

Name Type Description Default
python_exe Path

Path to the venv Python executable.

required
log InstallerLogger

Installer logger for user-facing messages.

required
Source code in umeairt_installer/installer/finalize.py
def install_cli_in_environment(
    python_exe: Path,
    log: InstallerLogger,
) -> None:
    """Install the ``umeairt-comfyui-installer`` CLI into the venv.

    Required for generated tool scripts (``UmeAiRT-Manager.bat``…).

    The CLI is installed as a regular (non-editable) package: an editable
    install linked the environment to the bootstrap's clone in ``%TEMP%``,
    so cleaning the temp folder broke the Manager. From a source checkout
    the checkout is built and installed; from an installed wheel (no
    ``pyproject.toml`` next to the package) the same version is installed
    from PyPI. ``update`` later upgrades it in place (see ``self_update``).

    Args:
        python_exe: Path to the venv Python executable.
        log: Installer logger for user-facing messages.
    """
    from umeairt_installer import __version__

    log.item("Installing umeairt-comfyui-installer CLI into environment...")
    installer_root = Path(__file__).resolve().parent.parent.parent
    if (installer_root / "pyproject.toml").is_file():
        uv_install(python_exe, [str(installer_root)])
    else:
        uv_install(python_exe, [f"umeairt-comfyui-installer=={__version__}"])
    log.sub("umeairt-comfyui-installer CLI available in environment.", style="success")

install_comfy_settings(install_path, log, *, source_dir=None)

Copy custom ComfyUI UI settings from the local source.

Searches for comfy.settings.json in the source scripts/ directory and copies it to install_path/user/default/.

Parameters:

Name Type Description Default
install_path Path

Root installation directory.

required
log InstallerLogger

Installer logger for user-facing messages.

required
source_dir Path | None

Pre-resolved source scripts directory.

None
Source code in umeairt_installer/installer/finalize.py
def install_comfy_settings(
    install_path: Path,
    log: InstallerLogger,
    *,
    source_dir: Path | None = None,
) -> None:
    """Copy custom ComfyUI UI settings from the local source.

    Searches for ``comfy.settings.json`` in the source ``scripts/``
    directory and copies it to ``install_path/user/default/``.

    Args:
        install_path: Root installation directory.
        log: Installer logger for user-facing messages.
        source_dir: Pre-resolved source scripts directory.
    """
    import shutil

    if source_dir is None:
        from umeairt_installer.installer.environment import find_source_scripts
        try:
            source_dir = find_source_scripts()
        except FileNotFoundError:
            log.warning("Source scripts directory not found. Skipping settings.", level=2)
            return

    settings_src = source_dir / "comfy.settings.json"
    if not settings_src.exists():
        log.warning("comfy.settings.json not found in source scripts.", level=2)
        return

    dest = install_path / "user" / "default" / "comfy.settings.json"
    dest.parent.mkdir(parents=True, exist_ok=True)

    if dest.exists() and settings_src.stat().st_mtime <= dest.stat().st_mtime:
        log.sub("ComfyUI settings already up to date.", style="success")
        return

    shutil.copy2(settings_src, dest)
    log.item("ComfyUI custom settings provisioned.")

create_launchers(install_path, log, *, cuda_tag=None, torch_profile='classic')

Generate cross-platform launcher and manager scripts.

Creates:

  • Performance launcher: attention backend + --auto-launch
  • --enable-manager (the Manager built into ComfyUI) with listen address read from scripts/listen_address.
  • LowVRAM launcher: same + --lowvram --disable-smart-memory --fp8.
  • Manager script: UmeAiRT-Manager — opens the TUI for updates, model downloads, settings, and reinstall.

On Windows, creates .bat files; on Linux/macOS .sh files with the executable bit set.

Uses --use-ck-attention for the modern profile and --use-sage-attention for the classic profile (NVIDIA only).

Parameters:

Name Type Description Default
install_path Path

Root installation directory.

required
log InstallerLogger

Installer logger for user-facing messages.

required
cuda_tag str | None

The active GPU tag (used to detect NVIDIA for attention flags).

None
torch_profile str

"classic" or "modern".

'classic'
Source code in umeairt_installer/installer/finalize.py
def create_launchers(
    install_path: Path,
    log: InstallerLogger,
    *,
    cuda_tag: str | None = None,
    torch_profile: str = "classic",
) -> None:
    """Generate cross-platform launcher and manager scripts.

    Creates:

    - **Performance launcher**: attention backend + ``--auto-launch``
      + ``--enable-manager`` (the Manager built into ComfyUI)
      with listen address read from ``scripts/listen_address``.
    - **LowVRAM launcher**: same + ``--lowvram --disable-smart-memory --fp8``.
    - **Manager script**: ``UmeAiRT-Manager`` — opens the TUI for
      updates, model downloads, settings, and reinstall.

    On Windows, creates ``.bat`` files; on Linux/macOS ``.sh`` files
    with the executable bit set.

    Uses ``--use-ck-attention`` for the *modern* profile and
    ``--use-sage-attention`` for the *classic* profile (NVIDIA only).

    Args:
        install_path: Root installation directory.
        log: Installer logger for user-facing messages.
        cuda_tag: The active GPU tag (used to detect NVIDIA for attention flags).
        torch_profile: ``"classic"`` or ``"modern"``.
    """
    log.item("Creating launcher scripts...")

    is_windows = sys.platform == "win32"

    # Attention backend is NVIDIA-only — omit on macOS/CPU/AMD
    is_nvidia = cuda_tag is not None and cuda_tag.startswith("cu")
    if is_nvidia:
        attn_flag = "--use-ck-attention" if torch_profile == "modern" else "--use-sage-attention"
        perf_args = f"{attn_flag} --auto-launch {MANAGER_FLAG}"
    else:
        perf_args = f"--auto-launch {MANAGER_FLAG}"
    lowvram_args = f"{perf_args} --disable-smart-memory --lowvram --fp8_e4m3fn-text-enc"

    launchers: list[tuple[str, str, str]] = [
        ("UmeAiRT-Start-ComfyUI", "Performance Mode", perf_args),
        ("UmeAiRT-Start-ComfyUI_LowVRAM", "Low VRAM / Stability Mode", lowvram_args),
    ]

    for name, mode_label, args in launchers:
        if is_windows:
            _write_bat_launcher(install_path, name, mode_label, args, log)
        else:
            _write_sh_launcher(install_path, name, mode_label, args, log)

    # Manager script (launches the TUI)
    write_manager_script(install_path, log)

write_manager_script(install_path, log)

Write (or rewrite) the UmeAiRT-Manager script that opens the TUI.

Source code in umeairt_installer/installer/finalize.py
def write_manager_script(install_path: Path, log: InstallerLogger) -> None:
    """Write (or rewrite) the ``UmeAiRT-Manager`` script that opens the TUI."""
    if sys.platform == "win32":
        _write_bat_tool(install_path, "UmeAiRT-Manager", "UmeAiRT Manager", MANAGER_COMMAND, log)
    else:
        _write_sh_tool(install_path, "UmeAiRT-Manager", "UmeAiRT Manager", MANAGER_COMMAND, log)

add_manager_flag_to_launchers(install_path, log)

Add --enable-manager to existing launchers, in place.

Launchers written before the switch to the Manager built into ComfyUI start without it, so the legacy custom-node clone keeps running. Only the main.py command line is touched: anything the user added is kept.

Returns:

Type Description
int

The number of launchers updated.

Source code in umeairt_installer/installer/finalize.py
def add_manager_flag_to_launchers(install_path: Path, log: InstallerLogger) -> int:
    """Add ``--enable-manager`` to existing launchers, in place.

    Launchers written before the switch to the Manager built into ComfyUI
    start without it, so the legacy custom-node clone keeps running. Only the
    ``main.py`` command line is touched: anything the user added is kept.

    Returns:
        The number of launchers updated.
    """
    updated = 0
    for name in LAUNCHER_NAMES:
        for path in (install_path / f"{name}.bat", install_path / f"{name}.sh"):
            if not path.is_file():
                continue
            raw = path.read_bytes()
            text = raw.decode("utf-8", errors="surrogateescape")
            if MANAGER_FLAG in text:
                continue
            # The launch line is `"<python>" -s "<...>main.py" <args>`; the
            # `if not exist "<...>main.py" (` guard above it must stay intact.
            new_text, count = re.subn(r'(-s\s+"[^"\r\n]*main\.py")', rf"\1 {MANAGER_FLAG}", text, count=1)
            if count == 0:
                continue
            path.write_bytes(new_text.encode("utf-8", errors="surrogateescape"))
            updated += 1
    if updated:
        log.sub(f"Launchers now enable the built-in ComfyUI-Manager ({updated} updated).", style="success")
    return updated

offer_model_downloads(install_path, log, *, source_dir=None)

Offer interactive model pack downloads via the unified catalog.

Searches for model_manifest.json in multiple locations:

  1. install_path/scripts/
  2. Source scripts/ directory (development checkout).
  3. Parent of source scripts/ directory.

If found, prompts the user and delegates to :func:umeairt_installer.downloader.engine.interactive_download.

Parameters:

Name Type Description Default
install_path Path

Root installation directory.

required
log InstallerLogger

Installer logger for user-facing messages.

required
source_dir Path | None

Pre-resolved source scripts directory.

None
Source code in umeairt_installer/installer/finalize.py
def offer_model_downloads(
    install_path: Path,
    log: InstallerLogger,
    *,
    source_dir: Path | None = None,
) -> None:
    """Offer interactive model pack downloads via the unified catalog.

    Searches for ``model_manifest.json`` in multiple locations:

    1. ``install_path/scripts/``
    2. Source ``scripts/`` directory (development checkout).
    3. Parent of source ``scripts/`` directory.

    If found, prompts the user and delegates to
    :func:`umeairt_installer.downloader.engine.interactive_download`.

    Args:
        install_path: Root installation directory.
        log: Installer logger for user-facing messages.
        source_dir: Pre-resolved source scripts directory.
    """

    # Search for catalog in multiple locations
    search_paths = [
        install_path / "scripts" / "model_manifest.json",
    ]

    # Also check source scripts directory (running from source checkout)
    if source_dir is None:
        from umeairt_installer.installer.environment import find_source_scripts
        try:
            source_dir = find_source_scripts()
        except FileNotFoundError:
            source_dir = None

    if source_dir:
        search_paths.append(source_dir / "model_manifest.json")
        search_paths.append(source_dir.parent / "model_manifest.json")

    catalog_path = None
    for path in search_paths:
        if path.exists():
            catalog_path = path
            break

    if catalog_path is None:
        log.info("No model catalog found. Searched:")
        for p in search_paths:
            log.sub(f"  {p}", style="dim")
        log.info("You can download models later with: umeairt-comfyui-installer download-models")
        return

    log.sub(f"Catalog found: {catalog_path}", style="success")

    if not confirm("Would you like to download model packs now?"):
        log.sub("Model downloads skipped. You can download later with: umeairt-comfyui-installer download-models")
        return

    from umeairt_installer.downloader.engine import interactive_download, load_catalog

    catalog = load_catalog(catalog_path)
    models_dir = install_path / "models"
    interactive_download(catalog, models_dir)