Comfy-Org / Comfy-Org/comfy-aimdo
torch bridge requires numpy at runtime but the package declares no dependency on it
- Dominant language
- C
- Stars
- 67
- Forks
- 39
- Avg merge
- 1d 25m
- Merged PRs (30d)
- 10
Description
`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.
Contributor guide
Research direction
Inspect comfy_aimdo/torch.py around get_tensor_from_raw_ptr and pyproject.toml's dependency declarations. Reproduce the bridge with NumPy unavailable, then determine whether the package metadata or the torch module should communicate the requirement; done means a fresh install no longer leaves this path failing without a clear explanation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100