RuntimeError: operator torchvision::nms does not exist

To reproduce

pip install --pre torch torchvision torchaudio -i https://download.pytorch.org/whl/nightly/cu118

(taken from Pytorch Bench README)

then

python -c "import torchvision"

INFO

Python

Python 3.8.10

Torch:

2.2.0.dev20231129+cpu

pip show torchvision

Name: torchvision
Version: 0.17.0.dev20231129+cu118
Summary: image and video datasets and models for torch deep learning
Home-page: https://github.com/pytorch/vision
Author: PyTorch Core Team
Author-email: soumith@pytorch.org
License: BSD
Location: /data/agoldf6/mypy/lib/python3.8/site-packages
Requires: numpy, torch, pillow, requests
Required-by: x-clip, torchbench, torch-fidelity, timm, open-clip-torch, lpips, effdet, dalle2-pytorch, DALL-E, clip-anytorch

Full output:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/data/agoldf6/mypy/lib/python3.8/site-packages/torchvision/__init__.py", line 6, in <module>
    from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
  File "/data/agoldf6/mypy/lib/python3.8/site-packages/torchvision/_meta_registrations.py", line 164, in <module>
    def meta_nms(dets, scores, iou_threshold):
  File "/data/agoldf6/mypy/lib/python3.8/site-packages/torch/library.py", line 439, in inner
    handle = entry.abstract_impl.register(func_to_register, source)
  File "/data/agoldf6/mypy/lib/python3.8/site-packages/torch/_library/abstract_impl.py", line 30, in register
    if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
RuntimeError: operator torchvision::nms does not exist

Your install command specifies cu118 while you’ve installed the CPU-only binaries, so something failed. Make sure you have a single torch and torchvision installation with the same CUDA runtime dependencies.

2 Likes