2023/3/11 this article only considers about python 3.6 version
Preparation
Jetson device(Mine: Jetson NX) with CUDA and CUDNN (CUDA toolkit)
# 查看版本
sudo apt list | grep cuda-core
# 按照系统提供的版本直接安装
sudo apt install cuda-core-10-2
sudo apt list --installed | grep cuda
...
Installation step
- Install some required package
sudo apt-get update
# for Tensorflow2
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran
sudo apt-get install python3-pip
# for Pytorch
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
pip3 install Cython
2. Make sure your JetPack has been installed
#use jtop to check your jetpack version
jtop
3. Download the corresponding version package for your device
Please make sure the version is correct. (JetPack, Python=3.6)
Then install
# For Pytorch
# Please check out which version fits your device
# https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
# wget website -O renamed_name
wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-1.8.0-cp36-cp36m-linux_aarch64.whl
# Rename method if you fail to get the right name
# mv strange_name renamed_name
# install Pytorch
# torch-1.8.0-cp36-cp36m-linux_aarch64.whl means the file name you downloaded
# change it if you're not using the same version as I
pip3 install numpy==1.19.4 torch-1.8.0-cp36-cp36m-linux_aarch64.whl
# For Tensorflow
# Please check out which version fits your device
# https://forums.developer.nvidia.com/t/official-tensorflow-for-jetson-nano/71770
# "Python 3.6+JetPack4.6.3" also works with "Python 3.6+JetPack4.6"
sudo pip3 install -U pip testresources setuptools
sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
sudo pip3 install -U numpy==1.19.4 future mock keras_preprocessing keras_applications gast==0.2.1 protobuf pybind11 cython pkgconfig packaging
sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v461 tensorflow
4. There will be some problems happening while using numpy=1.19.5, so we should downgrade it if it is in 1.19.5 (Pytorch)
pip3 install numpy==1.19.4
5. Torchvision installation (Pytorch)
make sure you have the correct version
(ex: Pytorch=1.9.0, Torchvision=0.10.0, Python=3.6)
Check the version: https://github.com/pytorch/vision
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
# Download torchvision folder from github by git
# or you can download it by yourself
# Check the version: https://github.com/pytorch/vision
git clone --branch <version> https://github.com/pytorch/vision torchvision # see below for version of torchvision to download
# go to the dir
cd torchvision
# where 0.x.0 is the torchvision version, change it into your version
export BUILD_VERSION=0.x.0
# install torchvision
python3 setup.py install --user
cd ../ # attempting to load torchvision from build dir will result in import error
6. Done
You need to test if your DL works, or you may redo it again and find out which steps you miss or any error messages.