Running PyTorch on Jetson TX2

Hello,

I’m trying to run PyTorch on my Jetson TX2, as I need to run torch with Cuda enabled. My system has JetPack 4.4, Cuda 10.2 and Python 3.6 installed.
I have followed this tutorial:

And used the file for JetPack 4.4/PyTorch v1.10.0/Python 3.6 mentioned here:

I had successfully completed the installation. Then via pycharm I try to run “import torch” and I get the error “Process finished with exit code 132 (interrupted by signal 4: SIGILL)”. To my understanding, this could be due to a compatibility issue, which I haven’t been able to solve.

I would appreciate your help as this is needed for my final year project at university.
Thanks!

Hi,

Could you try to import PyTorch without pycharm to see if it works?

Thanks.

If that works, what packages in pycharm could cause the error?

@shovalff on the chance that it’s this numpy issue (numpy also gets imported when you import torch), you might want to try running export OPENBLAS_CORETYPE=ARMV8 in your terminal first. And to rule out any issue with PyCharm picking up that environment variable, try running this independently as a test:

OPENBLAS_CORETYPE=ARMV8 python3 -c 'import torch'

Thank you for your help. That worked and now I can import torch.
I’m now encountering a different error:

Error: torch is not compiled with cuda enabled

And running the following:

print(torch.version)
print(torch.cuda.is_available())

Returns:

1.10.2
False

I have also set the environment variables:

$CUDA_HOME=/usr/local/cuda-10.2
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.2/lib64

@shovalff try re-installing one of the PyTorch wheels for JetPack 4 from PyTorch for Jetson thread

That worked and Cuda is now available. However, I now have a different error.
I installed torchvision v0.11.1 which is compatible with pytorch v1.10, based on the instructions here.
When running:

from torchvision import io
image = io.read_image(“path/to/image”)

I now get the error:

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

I tried reinstalling torchvision and noticed the following in the terminal:

Using /home/nvidia/.local/lib/python3.6/site-packages
Searching for torch==1.10.2
Best match: torch 1.10.2
Adding torch 1.10.2 to easy-install.pth file

It seems that it’s configured for the previous version of torch I had installed (1.10.2) instead of v1.10.0, and perhaps installing the wrong packages. How can I alter it?

Sorry, I’m not sure. I would recommend trying l4t-pytorch container or using a different image loader (like PIL) if torchvision.io is giving you trouble.

I had managed to solve the problem by completely removing and installing torchvision again. Thank you for your help!

1 Like

OK great, glad you got it working! Sometimes it’s a challenge to keep the versions of PyTorch/torchvision that you want installed (because pip likes to change them on you)

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