Torch v1.9.0 shows incompatible with torchvision v0.10.0

Hi,

While running my code in NVIDIA AGX Xavier™ device ( JetPack v4.6.3), I am getting the following error:

File "/home/ravi/.local/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 102, in _batched_nms_vanilla
  curr_keep_indices = nms(boxes[curr_indices], scores[curr_indices], iou_threshold)
File "/home/ravi/.local/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 34, in nms
  _assert_has_ops()
File "/home/ravi/.local/lib/python3.6/site-packages/torchvision/extension.py", line 63, in _assert_has_ops
  "Couldn't load custom C++ ops. This can happen if your PyTorch and "
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

Based on the official documentation, it seems that torch v1.9.0 is compatible with torchvision v0.10.0. But I am still getting the error. Please see more info. below:

$ ipython3
Python 3.6.9 (default, Nov 25 2022, 14:10:45) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.3 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import torch

In [2]: import torchvision

In [3]: torch.cuda.is_available()
Out[3]: True

In [4]: torch.__version__
Out[4]: '1.9.0'

In [5]: torchvision.__version__
Out[5]: '0.10.0'

Please suggest a workaround to get torchvision working.

Thank you.

Hi @RaviJoshi, I would recommend building torchvision from source. It will then be built against the version of PyTorch you have installed and with CUDA enabled. You can find instructions for building torchvision under the Installation section of this post: https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048

Alternatively, you could run the l4t-pytorch container which comes with PyTorch and torchvision already pre-installed.

Hi @dusty_nv

Building torchvision from source works like a charm!

Thank you very much.

Hi @RaviJoshi, glad you got it working! happy to help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.