PyTorch for Jetson - version 1.7.0 now available

Hi Dusty,

Yap I did what you mentioned. However, the forum post do not seem to show the underscores. The error remains the same:

Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘torchvision’ has no attribute ‘ version

Is the error due to a bad installation?

Hi @jiangwei.wang, it seems this error is unrelated to installing PyTorch pre-requisites. Instead it may be from using OTA update with a different carrier board - please see this post:

You may want to re-flash your device with ConnectTech’s BSP for the latest JetPack release.

Hmm, when you view the post, does it look different than below? (I have added the orange boxes for emphasis on the relevant version commands:

To get the versions, there should be two underscores before and two underscores after:

print(torch.__version__)
print(torchvision.__version__)

Does either of those work for you?

Hello,

What am I supposed to do?

Thank you.

@neuezeal if you are after 0.6.0 then command should be

git clone --branch v0.6.0 https://github.com/pytorch/vision torchvision

Need to add v before 0.6.0

1 Like

There appears to be a BIG problem with the 1.6.0 PyTorch wheel - it installs the wrong version (1.4.0!) This was driving me nuts until I read the output after installation carefully:

$ pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl
Collecting numpy
Processing ./torch-1.6.0-cp36-cp36m-linux_aarch64.whl
Installing collected packages: numpy, torch
Successfully installed numpy-1.19.2 torch-1.4.0

Notice how, even though I downloaded and installed the “1.6.0” wheel, pip reports that I have installed torch-1.4.0.

I have resorted to using the “release candidate” version of this wheel (PyTorch for JetPack 4.4 - L4T R32.4.3 in Jetson Xavier NX) which worked flawlessly. (I am running JetPack 4.4 on a Xavier NX)

Hi @stephen.buchanan, is this the link you are using to download the 1.6.0 wheel?

https://nvidia.box.com/shared/static/9eptse6jyly1ggt9axbja2yrmj6pbarc.whl

For me that does indeed install 1.6.0…

Is it possible that you had 1.4.0 previously installed on your system? You might want to try running pip3 uninstall torch and sudo pip3 uninstall torch first.

you may also try using docker containers with preinstalled pytorch from https://ngc.nvidia.com/catalog/containers/nvidia:l4t-pytorch so that there will be no need to build it from [github] sources
@neuezeal you may also try these steps

wget https://nvidia.box.com/shared/static/9eptse6jyly1ggt9axbja2yrmj6pbarc.whl 
mv 9eptse6jyly1ggt9axbja2yrmj6pbarc.whl torch-1.6.0-cp36-cp36m-linux_aarch64.whl
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev 
pip3 install Cython
pip3 install numpy torch-1.6.0-cp36-cp36m-linux_aarch64.whl
 sudo apt-get install libjpeg-dev zlib1g-dev
  git clone --branch v0.7.0 https://github.com/pytorch/vision torchvision
  cd torchvision
   export BUILD_VERSION=0.7.0
 sudo python3 setup.py install
cd ../
1 Like

Hello,

(env_name1) jetson8@jetson8-desktop:~/coding$ pip3 install numpy torch-1.5.0-cp36-cp36m-linux_aarch64.whl
Requirement already satisfied: numpy in /home/jetson8/.local/lib/python3.6/site-packages (1.19.2)
Processing ./torch-1.5.0-cp36-cp36m-linux_aarch64.whl
Installing collected packages: torch
Attempting uninstall: torch
Found existing installation: torch 1.4.0
Uninstalling torch-1.4.0:
Successfully uninstalled torch-1.4.0
Successfully installed torch-1.4.0
(env_name1) jetson8@jetson8-desktop:~/coding$ cd torchvision/
(env_name1) jetson8@jetson8-desktop:~/coding/torchvision$ ls
cmake CODE_OF_CONDUCT.md examples LICENSE packaging references setup.py torchvision travis-scripts
CMakeLists.txt docs hubconf.py MANIFEST.in README.rst setup.cfg test tox.ini
(env_name1) jetson8@jetson8-desktop:~/coding/torchvision$ sudo python3 setup.py install
Traceback (most recent call last):
File “setup.py”, line 13, in
import torch
ModuleNotFoundError: No module named ‘torch’

What am I supposed to do?
Thank you.

@neuezeal
at some point it is required to get out from a build folder before using torch: ../
also you may try to repeat steps from the post before in exact manner;
from the first step to tthe last one.
which will be the output if you do?
Is there any particular reaon why you are trying to install torch-1.4.0 , but not 1-6.0 as it was proposed?
Also I would suggest to uninstall any existing torch package before trying to install it again with pip3

1 Like

Hello,


I hope to run this project.
it requires torch version 1.5.0

Thank you.

I did not try this project;
Maybe other folks will add.
However, I noticed that you were installing torch 1.4, not 1.5

1 Like

Ah, it is the instructions which are confusing!

The installation instructions are for v1.4.0, and while I did substitute 1.6.0 in the filename, I did not change the URL. The instructions say “Substitute the URL/filenames” which for me sounded like “URL or file names”, whereas you meant URL and filename!

Sorry, that was my mistake. But perhaps since the post title is about v1.6.0, the Installation instructions should probably include the 1.6.0 download/installation instructions by default!

Ah sorry about that, I have just updated the instructions to make it more clear.

I used the instruction for PyTorch 1.3, JetPack 4.4

But I can’t load PyTorch, I receive this error message:

from torch._C import *
ImportError: cannot open shared object file: No such file or directory.

Someone else get this message? And can give me tips?
Thank

For Jetpack 4.4 Production release only Pytorch 1.6 is supported.

1 Like

thanks

Thanks again.
I try to use PyTorch 1.6 ,
But, I got a different error:
OSError: libcurand.so.10: cannot open shared object file: No such file or directory

To verified the cuda 10 is in path I input in terminal:
echo $LD_LIBRARY_PATH
/usr/local/cuda-10.0/lib64:

Can you help me?

Hi @abraham.pelz, can you check your L4T version with cat /etc/nv_tegra_release and post the results of that command here? It seems maybe you installed a PyTorch wheel that wasn’t build for your version of JetPack-L4T.

Before installing another PyTorch, I also recommend running these commands to clear out previous install:

$ pip3 uninstall torch
$ sudo pip3 uninstall torch

Also if you continue to have issues installing PyTorch, I recommend using the l4t-pytorch container which already has it installed. You will want to use the tag of the container that matches your L4T version.

could you paste to here the output of execution of the steps below, please?

sudo apt install mlocate
sudo updatedb
locate libcurand.so

If the execution is from the docker container, then the entire cuda folder might need to be copied into the withing of the container