Try   HackMD

Install Pytorch & torchvision on Jetson Xavier NX

tags: Jetson Xavier NX

This is install for python 3.x .

Pytorch

The Jetpack version is 4.5 so I need to install pytorch v1.7 .

wget https://nvidia.box.com/shared/static/cs3xn3td6sfgtene6jdvsxlr366m2dhq.whl -O torch-1.7.0-cp36-cp36m-linux_aarch64.whl
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
pip3 install Cython
pip3 install numpy torch-1.7.0-cp36-cp36m-linux_aarch64.whl

Torchvision

To install torchvision first you have to check the corresponding version to CUDA.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

In my case, I had install the pytorch v1.7 so the version of torchvision should be v0.8.1 .

sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.8.1 https://github.com/pytorch/vision torchvision
cd torchvision
export BUILD_VERSION=0.8.1
sudo python3 setup.py install
pip3 uninstall pillow
pip3 install pillow==8.4.0
cd ../

Reference

https://forums.developer.nvidia.com/t/pytorch-for-jetson-version-1-7-0-now-available/72048