Pytorch runtime issue on Jetson Orin Nano

I installed pytorch as the guide says Installing PyTorch for Jetson Platform

But it’s quite weird, see below:

  • First time install
$ python3 -m pip install --no-cache --user $TORCH_INSTALL
Collecting torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654
  Downloading https://developer.download.nvidia.cn/compute/redist/jp/v60dp/pytorch/torch-2.3.0a0+6ddf5cf85e.nv24.04.14026654-cp310-cp310-linux_aarch64.whl (1035.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 GB 8.9 MB/s eta 0:00:00
Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (4.9.0)
Requirement already satisfied: sympy in /usr/lib/python3/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (1.9)
Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.2.1)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.1.3)
Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (2024.2.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.10/site-packages (from jinja2->torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (2.1.5)
Installing collected packages: torch
  Attempting uninstall: torch
    Found existing installation: torch 2.2.2
    Uninstalling torch-2.2.2:
      Successfully uninstalled torch-2.2.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.2.2 requires torch==2.2.2, but you have torch 2.3.0a0+6ddf5cf85e.nv24.4 which is incompatible.
torchvision 0.17.2 requires torch==2.2.2, but you have torch 2.3.0a0+6ddf5cf85e.nv24.4 which is incompatible.
Successfully installed torch-2.3.0a0+6ddf5cf85e.nv24.4
  • Second time install
$ python3 -m pip install --no-cache --user $TORCH_INSTALLpython3 -m pip install --upgrade pip; python3 -m pip install numpy==’1.26.1’; python3 -m pip install --no-cache $TORCH_INSTALL^C
daniel@daniel-nvidia:~$ python3 -m pip install --upgrade pip; python3 -m pip install numpy==’1.26.1’; python3 -m pip install --no-cache $TORCH_INSTALL
Requirement already satisfied: pip in /usr/local/lib/python3.10/dist-packages (24.0)
ERROR: Could not find a version that satisfies the requirement numpy==’1.26.1’ (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0rc1, 1.24.0rc2, 1.24.0, 1.24.1, 1.24.2, 1.24.3, 1.24.4, 1.25.0rc1, 1.25.0, 1.25.1, 1.25.2, 1.26.0b1, 1.26.0rc1, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 2.0.0b1, 2.0.0rc1, 2.0.0rc2)
ERROR: No matching distribution found for numpy==’1.26.1’
Collecting torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654
  Downloading https://developer.download.nvidia.cn/compute/redist/jp/v60dp/pytorch/torch-2.3.0a0+6ddf5cf85e.nv24.04.14026654-cp310-cp310-linux_aarch64.whl (1035.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 GB 11.1 MB/s eta 0:00:00
Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.13.1)
Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (4.9.0)
Requirement already satisfied: sympy in /usr/lib/python3/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (1.9)
Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.2.1)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (3.1.3)
Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (2024.2.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.10/site-packages (from jinja2->torch==2.3.0a0+6ddf5cf85e.nv24.04.14026654) (2.1.5)
  • Run program got error below, it’s OK with torch 2.2.2 CPU version
RuntimeError                              Traceback (most recent call last)
Cell In[1], line 5
      3 import matplotlib.pyplot as plt
      4 import torch
----> 5 import torchvision.transforms as T
      6 import torchvision
      7 import torch

File ~/.local/lib/python3.10/site-packages/torchvision/__init__.py:6
      3 from modulefinder import Module
      5 import torch
----> 6 from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
      8 from .extension import _HAS_OPS
     10 try:

File ~/.local/lib/python3.10/site-packages/torchvision/_meta_registrations.py:164
    153     torch._check(
    154         grad.dtype == rois.dtype,
    155         lambda: (
   (...)
    158         ),
    159     )
    160     return grad.new_empty((batch_size, channels, height, width))
    163 @torch._custom_ops.impl_abstract("torchvision::nms")
--> 164 def meta_nms(dets, scores, iou_threshold):
    165     torch._check(dets.dim() == 2, lambda: f"boxes should be a 2d tensor, got {dets.dim()}D")
    166     torch._check(dets.size(1) == 4, lambda: f"boxes should have 4 elements in dimension 1, got {dets.size(1)}")

File ~/.local/lib/python3.10/site-packages/torch/library.py:467, in impl_abstract.<locals>.inner(func)
    464 else:
    465     func_to_register = func
--> 467 handle = entry.abstract_impl.register(func_to_register, source)
    468 if lib is not None:
    469     lib._registration_handles.append(handle)

File ~/.local/lib/python3.10/site-packages/torch/_library/abstract_impl.py:30, in AbstractImplHolder.register(self, func, source)
     24 if self.kernel is not None:
     25     raise RuntimeError(
     26         f"impl_abstract(...): the operator {self.qualname} "
     27         f"already has an abstract impl registered at "
     28         f"{self.kernel.source}."
     29     )
---> 30 if torch._C._dispatch_has_kernel_for_dispatch_key(self.qualname, "Meta"):
     31     raise RuntimeError(
     32         f"impl_abstract(...): the operator {self.qualname} "
     33         f"already has an DispatchKey::Meta implementation via a "
   (...)
     36         f"impl_abstract."
     37     )
     39 if torch._C._dispatch_has_kernel_for_dispatch_key(
     40     self.qualname, "CompositeImplicitAutograd"
     41 ):

RuntimeError: operator torchvision::nms does not exist

Can anyone help to fix the issue?

Hi,

operator torchvision::nms does not exist

It looks like the compatibility issue between PyTorch and TorchVision.
Could you share which TorchVision version do you use?

We recently have a prebuilt package of TorchVision and TorchAudio in the below link.
This should help your to get a working package directly:

Thanks.

1 Like

Well (PyTorch for Jetson), it works, thanks.