Remove cupy auto-install from __init__.py

No more pip calls at import time. Users get a clear error with
install instructions from the Load node if cupy is missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 13:24:06 +01:00
parent 4723dc329d
commit fb921ae620
2 changed files with 1 additions and 38 deletions

View File

@@ -161,7 +161,7 @@ pip install -r requirements.txt
`cupy` is needed for optical flow warping in BIM-VFI, SGM-VFI, and GIMM-VFI. EMA-VFI does **not** need cupy. `cupy` is needed for optical flow warping in BIM-VFI, SGM-VFI, and GIMM-VFI. EMA-VFI does **not** need cupy.
The node will attempt to auto-install the correct cupy package on first load. If that fails, you'll see a clear error message in ComfyUI with install instructions. To install manually: If cupy is missing, the Load node will show an error in ComfyUI with your CUDA version and the exact install command. To install:
1. Find your CUDA version: 1. Find your CUDA version:
```bash ```bash

View File

@@ -1,40 +1,3 @@
import subprocess
import sys
import logging
logger = logging.getLogger("Tween")
def _ensure_cupy():
"""Try to auto-install cupy if missing, matching the PyTorch CUDA version."""
try:
import cupy # noqa: F401
return
except ImportError:
pass
try:
import torch
if not torch.cuda.is_available() or not hasattr(torch.version, "cuda") or torch.version.cuda is None:
logger.warning(
"[Tween] CUDA not available — cupy cannot be installed. "
"SGM-VFI and GIMM-VFI require CUDA."
)
return
major = int(torch.version.cuda.split(".")[0])
cupy_pkg = f"cupy-cuda{major}x"
logger.info(f"[Tween] Installing {cupy_pkg} (CUDA {torch.version.cuda})...")
subprocess.check_call([sys.executable, "-m", "pip", "install", cupy_pkg])
except Exception as e:
logger.warning(
f"[Tween] Could not auto-install cupy: {e}\n"
f"[Tween] SGM-VFI and GIMM-VFI will not work without cupy. Install manually:\n"
f"[Tween] pip install cupy-cuda12x # replace 12 with your CUDA major version"
)
_ensure_cupy()
from .nodes import ( from .nodes import (
LoadBIMVFIModel, BIMVFIInterpolate, BIMVFISegmentInterpolate, TweenConcatVideos, LoadBIMVFIModel, BIMVFIInterpolate, BIMVFISegmentInterpolate, TweenConcatVideos,
LoadEMAVFIModel, EMAVFIInterpolate, EMAVFISegmentInterpolate, LoadEMAVFIModel, EMAVFIInterpolate, EMAVFISegmentInterpolate,