Skip to content

Setup on WSL (Ubuntu 22.04)

Chiming NI edited this page Apr 25, 2023 · 9 revisions

Note: As our team shifts towards Jetson Orin Nano, we think it's better to use Ubuntu 22.04 as our testing environment. However, most of the parts are identical between different versions of Ubuntu, so the following steps should possibly also work on Ubuntu 18.04 and 20.04.

Install CMake

sudo apt install cmake

Install Boost

sudo apt install libboost-all-dev

Install Protocol Buffer

sudo apt install libprotobuf-dev protobuf-compiler

Install ZBar

sudo apt-get install libzbar-dev libzbar0

Install CUDA

To install CUDA 12.1 on Ubuntu 22.04, follow the instructions on NVIDIA's website.

Note: It is advised to use network repo method for WSL installation as it's much simpler than the local repo method.

Example Shell Commands (⚠️may not work on your machine, think before executing):

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get install cuda

Install cuDNN 8.6.0

To install cuDNN 8.6.0 on Ubuntu 22.04, follow the instructions on NVIDIA's website.

Note: Network repo method doesn't work for cuDNN on WSL. Use local repo method instead.

Assuming you've downloaded cudnn-local-repo-ubuntu2204-8.6.0.163_1.0-1_amd64.deb to the current directory. Example Shell Commands (⚠️may not work on your machine, think before executing):

sudo dpkg -i cudnn-local-repo-ubuntu2204-8.6.0.163_1.0-1_amd64.deb
sudo cp /var/cudnn-local-repo-*/cudnn-local-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get install libcudnn8

Install TensorRT 8.5.3

To install TensorRT 8.5.3 on Ubuntu 22.04, follow the instructions on NVIDIA's website.

Note: Network repo method doesn't work for TensorRT on WSL. Use local repo method instead.

Assuming you've downloaded nv-tensorrt-local-repo-ubuntu2204-8.5.3-cuda-11.8_1.0-1_amd64.deb to the current directory. Example Shell Commands (⚠️may not work on your machine, think before executing):

sudo dpkg -i nv-tensorrt-local-repo-ubuntu2204-8.5.3-cuda-11.8_1.0-1_amd64.deb
sudo cp /var/nv-tensorrt-local-repo-ubuntu2204-8.5.3-cuda-11.8/*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get install tensorrt

Install OpenCV 4.7.0

OpenCV must be built from source on Ubuntu 22.04. To install OpenCV 4.7.0, follow the instructions on OpenCV's website.

Example Shell Commands (⚠️may not work on your machine, think before executing):

# Download and Extract
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
unzip opencv.zip
# Create build folder
mkdir -p build && cd build
# CMake build
cmake  ../opencv-4.x
# Build with make or ninja
cmake --build .
# Install compiled library
sudo make install
Clone this wiki locally