[GH-ISSUE #90] torch bridge requires numpy at runtime but the package declares no dependency on it #31

Open
opened 2026-10-26 22:23:50 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @Kosinkadink on GitHub (Aug 16, 2026).
Original GitHub issue: https://github.com/Comfy-Org/comfy-aimdo/issues/90

comfy_aimdo/torch.py builds tensors from __cuda_array_interface__ holders via torch.as_tensor(holder, device=device) (line 22 at v0.4.13, unchanged since v0.4.10). torch's as_tensor path for array-interface holders requires NumPy; without it the call fails at runtime:

File ".../comfy_aimdo/torch.py", line 22, in get_tensor_from_raw_ptr
    return torch.as_tensor(holder, device=device)
RuntimeError: Numpy is not available

(Reproduced with torch 2.13.0+cu130 and numpy hidden from the environment; also emits UserWarning: Failed to initialize NumPy: No module named 'numpy' from torch internals.)

pyproject.toml declares no runtime dependencies, so consumers installing comfy-aimdo get a working import but a broken tensor bridge unless numpy happens to be present. Suggest either declaring numpy as a dependency (or an extra alongside the torch integration), or documenting the requirement and raising a clear ImportError from comfy_aimdo.torch when numpy is absent.

Found while aligning Domfy to comfy-aimdo 0.4.13; Domfy now declares numpy in its own extra to compensate.

Originally created by @Kosinkadink on GitHub (Aug 16, 2026). Original GitHub issue: https://github.com/Comfy-Org/comfy-aimdo/issues/90 `comfy_aimdo/torch.py` builds tensors from `__cuda_array_interface__` holders via `torch.as_tensor(holder, device=device)` (line 22 at v0.4.13, unchanged since v0.4.10). torch's `as_tensor` path for array-interface holders requires NumPy; without it the call fails at runtime: ``` File ".../comfy_aimdo/torch.py", line 22, in get_tensor_from_raw_ptr return torch.as_tensor(holder, device=device) RuntimeError: Numpy is not available ``` (Reproduced with torch 2.13.0+cu130 and numpy hidden from the environment; also emits `UserWarning: Failed to initialize NumPy: No module named 'numpy'` from torch internals.) `pyproject.toml` declares no runtime dependencies, so consumers installing comfy-aimdo get a working import but a broken tensor bridge unless numpy happens to be present. Suggest either declaring `numpy` as a dependency (or an extra alongside the torch integration), or documenting the requirement and raising a clear ImportError from `comfy_aimdo.torch` when numpy is absent. Found while aligning Domfy to comfy-aimdo 0.4.13; Domfy now declares numpy in its own extra to compensate.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/comfy-aimdo#31
No description provided.