PyTorch for Jetson - version 1.11 now available

Hi @Raymond_456, I haven’t tried to build this older version of PyTorch for JetPack 5.0, so JetPack 5.0’s newer CUDA version may have required some updates in PyTorch. I think the first version I built for it was PyTorch 1.11.

Is anyone installed torchvision for pytorch 1.11? which version you used?

I’m using torchvision 0.12 for PyTorch 1.11, and haven’t encountered this error. I ran this test code which uses the same torchvision.ops.nms function, and it runs fine here and doesn’t throw the exception.

import torch
import torchvision

def test_nms(N=128):
    boxes = []
    scores = []
    
    for n in range(N):
        boxes.append((n, n+1, n, n+1))
        scores.append(n)

    boxes = torch.Tensor(boxes)
    scores = torch.Tensor(scores)
    indices = torchvision.ops.nms(boxes, scores, 0.5)
    
test_nms()

I am running the exact same code you copied and it gives me error:
python3 test.py
/home/x1demo/.local/lib/python3.8/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
File “test.py”, line 16, in
test_nms()
File “test.py”, line 14, in test_nms
indices = torchvision.ops.nms(boxes, scores, 0.5)
File “/home/x1demo/.local/lib/python3.8/site-packages/torchvision/ops/boxes.py”, line 39, in nms
_assert_has_ops()
File “/home/x1demo/.local/lib/python3.8/site-packages/torchvision/extension.py”, line 33, in _assert_has_ops
raise RuntimeError(
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 GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision 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.

should I reinstall my torchvision from the github?

Yes you could try that or try using the l4t-pytorch container. If you could save the build log from when you build torchvision that could be helpful to see any errors.

would you please tell me what exact branch of torchvision I need to install from github? I installed torch1.11 from * Python 3.8 - torch-1.11.0-cp38-cp38-linux_aarch64.whl

For PyTorch 1.11, I am using the v0.12.0 tag of torchvision: https://github.com/pytorch/vision/tree/v0.12.0

Thanks for your help I flash the orin and install the new jetpack 5.0.1
then I installed torch 1.11
then the torchvision 0.12.0
and it worked.

HI! I ran into a problem during the installation of torchvision. I’m an Jetson NX With Jetpack 4.6.1. Installed PyTorch 1.10 without any problems but I’m getting the following message during torchvision install. Any help what might be causing this?

gcc: error trying to exec ‘cc1plus’: execvp: No such file or directory
error: command ‘/usr/local/cuda/bin/nvcc’ failed with exit status 1

Hmm, can you try running sudo apt-get install build-essential ?

Then make sure you can do:

$ gcc --version
$ g++ --version

Thank you for the answer. Already tried build-essential previously, it’s up to date.
gcc version is 8.4.0
g++ version is 7.5.0

Nevermind, sorry for the silly question. Received the device from someone else, and found it strange that gcc and g++ versions were different. Used same main versions and now it works.

I too had similar problem as @user22290 after installing @dusty_nv 's torch-1.11.0-cp38-cp38 wheel on Xavier NX devkit with JP 5.01, no pip torchvision version worked, only after I built it from source it works now.