/jetson-packages-family

The ultimate software installation guide for Nvidia Jetson Nano/Xavier Dev Kit

Primary LanguageShellMIT LicenseMIT

Jetson Packages Family

License: MIT

*** CopyRight 2020 Kevin Yu. All rights reserved.

*** Author: Kevin Yu

*** Update Time: 2021/02/06

This repo aims to give you clear instructions on how to install packages on AArch64(ARM) Platform, especially in Jetson family. All the packages have been tested on Jetson AGX Xavier and Jetson Nano.

Dependencies Installation

Before performing any installation, you may need to install the following basic dependencies

$ sudo apt-get install -y nano curl 
# python3
$ sudo apt-get install -y python3-pip python3-dev python3-setuptools
# python2
$ sudo apt-get install -y python-pip python-dev python-setuptools
$ sudo apt-get install -y libcanberra-gtk0 libcanberra-gtk-module

Python-pip

$ pip3 install -U pip
$ pip install -U pip
$ pip3 install setuptools wheel cython
$ pip install setuptools wheel cython

Set CUDA Path

If you have not set CUDA Path yet, you might need to do so.

Setup with script

$ wget -qO- https://github.com/yqlbu/jetson-packages-family/raw/master/set_cuda.sh | bash -

Setup manually

$ cd ~
$ echo "export PATH=/usr/local/cuda/bin:\${PATH}" >> ${HOME}/.bashrc
$ echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\${LD_LIBRARY_PATH}" >> ${HOME}/.bashrc
$ echo "export CPATH=$CPATH:/usr/local/cuda/targets/aarch64-linux/include" >> ${HOME}/.bashrc
$ echo "export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda/targets/aarch64-linux/lib" >> {HOME}/.bashrc
$ source ~/.bashrc

Boot From SSD (Xavier Only)

Compared with Jetson Nano, an important feature comes with Jetson Xavier NX and Jetson AGX Xavier is that they come with the M.2 Key M connector. According to the third-party testing, the reading speed from my SSD is 7 times faster than the SD card. Thus, to boot from SSD will surely boost the performance of Jetson Xavier.

Guide to setup

Jetsonhacks RootOnNVMe repo

Fan Control

A script that can control the PWM fan with the change of the CPU temperature of any Jetson Machine (Jetson Nano, Jetson TX1, TX2, Jetson Xavier)

Guide to setup

Packages List

Pytorch

PyTorch v1.7.0 (JetPack 4.4)

Python 3.6 - torch-1.7.0-cp36-cp36m-linux_aarch64.whl

wget https://nvidia.box.com/shared/static/wa34qwrwtk9njtyarwt5nvo6imenfy26.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 v0.5.0 (compatible with PyTorch v1.4.0)

$ 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  # where 0.x.0 is the torchvision version  
$ sudo python3 setup.py install
$ cd ../  # attempting to load torchvision from build dir will result in import error
$ pip install 'pillow<7' # always needed for Python 2.7, not needed torchvision v0.5.0+ with Python 3.6

Verfication

$ python3 -c "import torch ; print(torch.__version__)"

To install other versions of PyTorch and Torchvision, please visit site HERE

Tensorflow

Python 3.6 + JetPack 4.4

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
sudo pip3 install -U pip
sudo pip3 install -U pip testresources setuptools numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11
# TF-2.x
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow==2.3.1+nv20.12
# TF-1.15
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 ‘tensorflow<2’

To install other versions of Tensorflow, checkout the sites below:

Jetson Xavier: HERE

Jetson Nano: HERE

Machine Learning

Python3 v3.6.9

Scikit-learn

Scikit-learn v0.24.0(Latest)

$ pip3 install scikit-learn

Scipy

Scipy v1.6.0(Latest)

$ apt-get install libatlas-base-dev gfortran
$ pip3 install -U scipy --user

Matplotlib

Matplotlib v3.3.3(Latest)

$ sudo apt install libfreetype6-dev
$ pip3 install -U matplotlib --user

Pycuda

Pycuda v2019.1.2(Latest)

pip3 install -U pycuda --user

Jupyter Lab

JupyterLab v3.0.0(Latest)

# install jupyter
$ pip3 install jupyterlab
$ pip3 install --upgrade --force jupyter-console

# export environment path
$ echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
$ source ~/.bashrc

# check installation version
$ jupyter lab -V

Install with Docker

$ docker run --name jupyterlab -d \
  -e TZ=Asia/Shanghai \
  -p 8888:8888 \
  -v /appdata/jupyterlab:/opt/app/data \
  hikariai/jupyterlab:latest

Run the app

$ jupyter lab --ip=* --port=8888 --no-browser --notebook-dir=/opt/app/data \
  --allow-root --NotebookApp.token='' --NotebookApp.password='' \
  --LabApp.terminado_settings='{"shell_command": ["/bin/bash"]}'

Usage Guide: https://github.com/yqlbu/jetson_lab

Pillow

Pillow v5.1.0(Latest)

$ pip3 install -U pillow --user

Pandas

Pandas v1.2.0(Latest)

$ pip3 install -U pandas --user

Numpy

Numpy v1.19.4(Latest)

$ pip3 install -U numpy --user

Seaborn

Seaborn v0.11.1(Latest)

$ pip3 install -U seaborn --user

ONNX

ONNX v1.4.1 (Python3.6 + JetPack 4.3/4.4)

$ sudo apt install protobuf-compiler libprotoc-dev
$ pip install onnx==1.4.1

LLVM

LLVM v3.9 (Python3.6 + JetPack 4.3/4.4)

$ sudo apt-get install llvm-3.9
$ export LLVM_CONFIG=/usr/lib/llvm-3.9/bin/llvm-config
$ cd ~
$ wget https://github.com/numba/llvmlite/archive/v0.16.0.zip
$ unzip v0.16.0.zip
$ cd llvmlite-0.16.0
$ sudo chmod 777 -R /usr/local/lib/python3.6/dist-packages/
$ python3 setup.py install

Numba

Numba v0.31 (Python3.6 + JetPack 4.3/4.4)

*** Notes: Numba requires LLVM pre-built, so please check out the instructions for LLVM and have it installed before installing Numba.

$ pip3 install numba==0.31 --user

Jetson Stats

Jetson-stats is a package to monitoring and control your NVIDIA Jetson [Xavier NX, Nano, AGX Xavier, TX1, TX2] Works with all NVIDIA Jetson ecosystem.

$ sudo -H pip install -U jetson-stats
$ sudo jtop

NeoVim Server

NeoVim Server is a containerized IDE-like text editor that runs on a web server.

Docs: https://github.com/yqlbu/neovim-server/wiki

Font Install:

$ mkdir -p ~/.local/share/fonts
$ cd ~/.local/share/fonts && curl -fLo "Droid Sans Mono for Powerline Nerd Font Complete.otf" https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf

Quick Install:

$ docker run -d \
    --name nvim-server \
    -p 6080:3000 \
    -p 8090:8090 \
    -v ~/workspace:/workspace \
    -v /appdata/nvim-server:/config \
    -e TZ=Asia/Shanghai \
    -e USER=<USER> \
    -e SECRET=<PASSWORD> \
    hikariai/nvim-server:latest

Wait for a couple seconds until the container finishes its bootstrap process, then visit http://localhost:6080/wetty

VS Code for aarch64

$ cd ~
$ curl -s https://packagecloud.io/install/repositories/swift-arm/vscode/script.deb.sh | sudo bash
$ sudo apt-get install -y code-oss

Code Server

Code-server is a Visual Studio Code instance running on a remote server accessible through any web browser. It allows you to code anywhere and on any device such as a tablet or laptop with a consistent integrated development environment (IDE)

Installation Guide: HERE

Quick Install:

$ docker run -d --name code-server \
  -v /appdata/code-server:/data \
  -p 8443:8443 \
  --privileged \
  --restart unless-stopped \
  hikariai/code-server:latest

The Web UI will be available at http://localhost:8443

Archiconda3

Archiconda3 is a distribution of conda for 64 bit ARM. Anaconda is a free and open-source distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment. Like Virtualenv, Anaconda also uses the concept of creating environments so as to isolate different libraries and versions.

$ cd ${HOME}
$ wget https://github.com/Archiconda/build-tools/releases/download/0.2.3/Archiconda3-0.2.3-Linux-aarch64.sh
$ sudo sh Archiconda3-0.2.3-Linux-aarch64.sh
$ rm -rf Archiconda3-0.2.3-Linux-aarch64.sh
$ cd ~
$ sudo chown -R $USER archiconda3/
$ export "PATH=~/archiconda3/bin:$PATH" >> ~/.bashrc
$ conda config --add channels conda-forge
$ conda -V
$ conda update conda
$ conda -V

To prevent conda from activating the base environment by default

$ conda config --set auto_activate_base false
$ export "PATH=/bin:/usr/bin:$PATH" >> ~/.bashrc
$ source ~/.bashrc

Please checkout site HERE for usage guide.

OpenCV

OpenCV v4.1.1 (Python2.7/3.6+ JetPack4.3/4.4)

$ cd ~
# purge old-version
$ sudo apt-get purge libopencv*
# install
$ bash <(wget -qO- https://github.com/yqlbu/jetson-packages-family/raw/master/OpenCV/install_opencv4.1.1_jetson.sh)

*** You may modify the script to install custom version of OpenCV

$ wget https://github.com/yqlbu/jetson-packages-family/raw/master/OpenCV/install_opencv4.1.1_jetson.sh

Pycharm

PyCharm is an integrated development environment (IDE) used in computer programming, specifically for the Python language. It is developed by the Czech company JetBrains.

PyCharm Professional

$ cd ~
$ sudo apt-get update && sudo apt-get install -y openjdk-8-jdk
$ wget https://download.jetbrains.com/python/pycharm-professional-2019.3.4.tar.gz?_ga=2.42966822.2056165753.1586158936-1955479096.1586158936 -O pycharm-professional-2019.3.4.tar.gz
$ tar -xzf pycharm-professional-2019.3.4.tar.gz && cd pycharm-2019.3.4/bin
$ sudo chmod +x pycharm.sh && mv pycharm.sh pycharm
$ sudo rm -rf pycharm-professional-2019.3.4.tar.gz
$ cd ~
$ echo 'export PATH=/home/'$USER'/pycharm-2019.3.4/bin:$PATH' >> .bashrc

PyCharm Community

$ cd ~
$ sudo apt-get update && sudo apt-get install -y openjdk-8-jdk
$ wget https://download.jetbrains.com/python/pycharm-community-2019.3.4.tar.gz?_ga=2.42966822.2056165753.1586158936-1955479096.1586158936 -O pycharm-community-2019.3.4.tar.gz
$ tar -xzf pycharm-community-2019.3.4.tar.gz && cd pycharm-2019.3.4/bin
$ sudo chmod +x pycharm.sh && mv pycharm.sh pycharm
$ sudo rm -rf pycharm-community-2019.3.4.tar.gz
$ cd ~
$ echo 'export PATH=/home/'$USER'/pycharm-2019.3.4/bin:$PATH' >> .bashrc

run

$ pycharm

*** Notes: You may find other versions HERE

Lazygit

Lazygit is a simple terminal UI for git commands, written in Go with the gocui library.

$ sudo add-apt-repository ppa:lazygit-team/release
$ sudo apt-get update
$ sudo apt-get install lazygit

Neofetch

Neofetch is a cross-platform, simple shell script that scans for your system’s information and displays it in a terminal, together with an ASCII image or any desired image next to the output.

$ sudo add-apt-repository ppa:dawidd0811/neofetch
$ sudo apt-get update
$ sudo apt-get install neofecth

Docker

Docker is basically a container engine which uses the Linux Kernel features like namespaces and control groups to create containers on top of an operating system and automates application deployment on the container. Docker uses Copy-on-write union file system for its backend storage.

$ cd ~
$ sudo wget -qO- https://get.docker.com/ | sh
$ sudo usermod -aG docker $USER
$ sudo systemctl enable docker 
$ sudo systemctl status docker 

Docker-compose

Docker-compose v1.27.4(Latest)

$ sudo apt-get update
$ sudo apt-get install -y python python-pip libffi-dev libssl-dev
$ sudo pip install docker-compose
$ docker-compose -v

L4T-Docker

NVIDIA L4T-Docker

Official Repo: https://github.com/NVIDIA/nvidia-docker

Install NVIDIA-Docker Runtime

$ sudo apt install -y nvidia-docker2
$ sudo systemctl daemon-reload
$ sudo systemctl restart docker
$ docker info | grep nvidia

Verify NVIDIA-Runtime

$ docker run -it --runtime nvidia hikariai/l4t-base-r32.4.3:latest bash 
$ cd samples/1_Utilities/deviceQuery
$ make
$ ./deviceQuery

Custom L4T-Docker Image is available HERE

Dlib

DLib is an open source C++ library implementing a variety of machine learning algorithms, including classification, regression, clustering, data transformation, and structured prediction. ... K-Means clustering, Bayesian Networks, and many others.

Dlib v19.18

$ cd ~
$ wget https://raw.githubusercontent.com/yqlbu/face_recognizer/master/setup.sh
$ sudo chmod +x setup.sh
$ ./setup.sh

LabelImg

LabelImg is a graphical image annotation tool and label object bounding boxes in images.

$ sudo apt-get install pyqt4-dev-tools
$ sudo apt-get install python-lxml
$ sudo apt-get install python-qt4
$ sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
$ git clone https://github.com/tzutalin/labelImg.git
$ cd labelImg
$ make qt4py2
$ python labelImg.py

Qt5

Qt is used for developing graphical user interfaces (GUIs) and multi-platform applications that run on all major desktop platforms and most mobile or embedded platforms. Most GUI programs created with Qt have a native-looking interface, in which case Qt is classified as a widget toolkit.

$ sudo apt-get install qt5-default qtcreator -y
$ sudo apt-get install pyqt5*
$ sudo apt install python3-pyqt5.qtsql

Kubernetes

Kubernetes has rapidly become a key ingredient in edge computing. With Kubernetes, companies can run containers at the edge in a way that maximizes resources, makes testing easier, and allows DevOps teams to move faster and more effectively as these organizations consume and analyze more data in the field.

K3S is a lightweight Kubernetes distribution developed by Rancher Labs, perfect for Edge Computing use cases where compute resources may be somewhat limited.

Installation and usage guide is available at HERE

Nomachine

Nomachine ARMv8 (compatible with Jetson Devices)

NoMachine is a free, cross-platform, serverless remot e desktop tool that lets you setup a remote desktop server on your computer using the NX video protocol. The client can be used to connect to the server from anywhere in the world.

Official Website: HERE

Change Resolution

The desktop resolution is typically determined by the capabilities of the display that is attached to Jetson. If no display is attached, a default resolution of 640x480 is selected. To use a different resolution, edit /etc/X11/xorg.conf and append the following lines:

Section "Screen"
   Identifier    "Default Screen"
   Monitor       "Configured Monitor"
   Device        "Tegra0"
   SubSection "Display"
       Depth    24
       Virtual 1280 800 # Modify the resolution by editing these values
   EndSubSection
EndSection

License

MIT License (C) Kevin Yu