Zexin Li

Please keep honest, open, patient, happy and visionary.

Jetson Build Torchvision

Synopsis

To whom needs GPU version of Torchvision running on NVIDIA Jetson. - Cannot simply install torchvision by pip.

Prerequisite checklist

  1. Check model of embedded board
  2. Prepare a virtual python environment (e.g., miniforge3), it’s not suggested to follow NVIDIA official version of guideline to install code by sudo (which may mess up system python environments).
  3. Check pre-built binary files on Jetson binaries, if there are some appropriate prebuilt wheels, then download them. Make sure to rename them into the formate like “ torch-1.10.0-cp36-cp36m-linux_aarch64.whl”.
  4. Install PyTorch via this blog.
  5. Query Torchvision version compatible with current PyTorch version.

Install by source code

Refer to this blog from NVIDIA forum

After installing PyTorch by wheels from NVIDIA, then install torchvision by source code to avoid compatibility issues.

1
2
3
4
5
6
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch <version> https://github.com/pytorch/vision torchvision # see below for version of torchvision to download
cd torchvision
export BUILD_VERSION=0.x.0 # where 0.x.0 is the torchvision version
# for instance: 0.16.0 refers to PyTorch v2.1.0
python setup.py install --user