Install PyTorch on Jetson Nano.
Last updated: July 12, 2021
This page will guide you through the installation of PyTorch 1.7.0, 1.7.1, 1.8.0, 1.8.1 or 1.9.0, TorchVision, LibTorch and Caffe2 on a Jetson Nano.
PyTorch is a software library specially developed for deep learning. It consumes an lot of resources of your Jetson Nano. So, don't expect miracles. It can run your models, but it can't train new models. The so-called transfer learning can cause problems due to the limited amount of available RAM.
PyTorch runs on Python. A C++ API is available, but we have not tested it.
We discuss two installations, one with a Python 3 wheel. The other method is the build from scratch. Unfortunately, there is no official pip3 wheel available for the Jetson Nano. However, we created these wheels and put them on GitHub for your convenience.
In order for Pytorch to work properly with the ARM NEON registers, we had to compile the framework using the clang compiler. It means that you should also use the clang compiler if you are going to compile C++ code yourself. The GCC compiler will give you 'no expression errors'.
PyTorch is build by Ninja. It takes more then 5 hours to complete the whole build. We have posted the wheels on our GitHub page. Feel free to use these. With all the tedious work already done, it takes now only a couple of minutes to install PyTorch on your Nano. For the diehards, the complete procedure is covered later in this manual.
Some warnings about version 1.9.0. As seen here, quite a few changes are made to the software since the last version. Not all operations and declarations are supported anymore. It can cause backward compatibility issues when your 1.8 networks are running on this new version.
The whole shortcut procedure is found below. The wheel was too large to store at GitHub, so Google drive is used. Please make sure you have latest pip3 and python3 version installed, otherwise, pip may come with the message ".whl is not a supported wheel on this platform".
JetPack 4 comes with Python 3.6.9. Undoubtedly, the Python version will upgrade over time and you will need a different wheel. See out GitHub page for all the wheels.