PyTorch 1.4 for Python2.7 on Jetpack 4.4.1[L4T 32.4.4]


I want to install Pytorch 1.4 for Python2.7 on my jetson nano which is installed with Jetpack 4.4.1[L4T 32.4.4]. This has default Cuda v10.2 installed on it. When I refer this link Pytorch whl, I dont see pytorch for this specific jetpack version. I tried installing using Jetpack 4.4 [L4T 32.4.2] and it installs properly but when I try to import Torch I get this error - ImportError: cannot open shared object file.

I believe it is built for Cuda 10.0, is there are any PyTorch for python2.7 whl built for the mentioned jetpack Jetpack 4.4.1[L4T 32.4.4].



We don’t have a prebuilt package for the python2.7 user.
You can get one by compiling it from source.

The instructions can also be found in the same topic:

Build from Source



Thanks for your reply. I tried building from the source by following the instructions provided. I am running into this error. Please help me understand this issue.

subprocess.CalledProcessError: Command '['cmake', '-GNinja', '-DBUILD_PYTHON=True', '-DBUILD_TEST=True', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_INSTALL_PREFIX=/home/dlinano/Desktop/Projects/Torch_1.4_py2.7/pytorch/torch', '-DCMAKE_PREFIX_PATH=/usr/lib/python2.7/dist-packages', '-DNUMPY_INCLUDE_DIR=/usr/lib/python2.7/dist-packages/numpy/core/include', '-DPYTHON_EXECUTABLE=/usr/bin/python2', '-DPYTHON_INCLUDE_DIR=/usr/include/python2.7', '-DPYTHON_LIBRARY=/usr/lib/', '-DTORCH_BUILD_VERSION=1.4.0', '-DUSE_DISTRIBUTED=0', '-DUSE_NCCL=0', '-DUSE_NUMPY=True', '-DUSE_PYTORCH_QNNPACK=0', '-DUSE_QNNPACK=0', '/home/dlinano/Desktop/Projects/Torch_1.4_py2.7/pytorch']' returned non-zero exit status 1

Also, before this error I see one of the messages stating PyTorch requires cuDNN 7 and above. But I jetpac4.4 comes with cuDNN 8. Please help me fix this.

This is the reason that the JetPack 4.4+ wheels are for PyTorch 1.6 and newer, because the updated cuDNN version required updates in PyTorch. So you would need to use JetPack 4.3 on your device if you wanted to use older PyTorch. Or you can run your code with PyTorch 1.6 (or newer) on JetPack 4.4+ and make any updates needed to use python3 instead. Python 2.7 is EOL so I recommend updating the code.