Today's goal is to install the TensorFlow GPU version. To install the TensorFlow GPU version, you need to successfully configure CUDA. However, before installing TensorFlow GPU, you also need to install some installation packages that are necessary for machine learning.
Note: The factory image has already installed tensorflow, so there is no need to install it.
Because Jetson Orin NX and Jetson Orin Nano use Docker technology, there is currently no function to install TensorFlow GPU. Therefore, this course is only valid for Jetson Nano motherboards.
1. Install pip
Because Python 3.6 is already installed in Jetson Nano, installing pip is relatively simple
xxxxxxxxxx
sudo apt-get install python3-pip python3-dev
After installation, pip is an older version and needs to be upgraded to the latest version
xxxxxxxxxx
python3 -m pip install --upgrade pip
After running pip3 -V successfully, it will display
2. Install those packages that are very important in the field of machine learning
xxxxxxxxxx
sudo apt-get install python3-numpy
(It is an extension library of the Python language that supports a large number of dimensional arrays and matrix operations. In addition, it also provides a large number of mathematical function libraries for array operations.)
xxxxxxxxxx
sudo apt-get install python3-scipy
(Scipy is a commonly used software package for mathematics, science, and engineering that can handle interpolation, integration, optimization, image processing, numerical solution of ordinary differential equations, signal processing, and other problems.)
xxxxxxxxxx
sudo apt-get install python3-pandas
(pandas is a tool based on NumPy that was created to solve data analysis tasks. Pandas incorporates a large number of libraries and some standard data models, providing the tools needed to efficiently operate large data sets. Pandas provides a large number of functions and methods that allow us to process data quickly and easily. You will soon find that it is one of the important factors that make Python a powerful and efficient data analysis environment.)
xxxxxxxxxx
sudo apt-get install python3-matplotlib
(Matplotlib is a Python 2D plotting library that produces publication-quality graphics in a variety of hardcopy formats and cross-platform interactive environments)
xxxxxxxxxx
sudo apt-get install python3-sklearn
(Simple and efficient data mining and data analysis tool)
3. Install TensorFlow GPU version
(1) Confirm that CUDA has been installed normally
xxxxxxxxxx
nvcc -V
If you can see the CUDA version number, it is installed correctly
If an error occurs, refer to this link for a solution
https://zhuanlan.zhihu.com/p/513220749
Install the required packages
xxxxxxxxxx
sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran
Install Python dependencies
xxxxxxxxxx
sudo pip3 install -U numpy==1.16.1 future==0.18.2 mock==3.0.5 h5py==3.10.0 keras_preprocessing==1.1.1 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11
(3.1) Online installation sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 tensorflow
The following is the tensorflow installation instructions on the official website. https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#install
(3.2) Offline installation
Because the online installation download is too slow, we can choose to install the offline package. The installation package needs to be downloaded from the Internet. You need to install the corresponding TensorFlow according to the JetPack version of the current system. There is also an offline package in our environment construction attachment, but you need to check whether it matches the jetpack version of your current system.
1) Upload the WHL file directly to the /home/jetson folder on jetson nano through winSCP software.
2) After uploading, enter the command (pip3 install + your corresponding version installation package)
xxxxxxxxxx
pip3 install xxx.whl
During the download, you may also need to install some software packages online. Just click Y (YES) to pass.
3) After the installation is complete, enter the following command to view the version number
xxxxxxxxxx
pip3 list | grep tensorflow
4) Enter the following command to check whether tensorflow is successfully installed.
xxxxxxxxxx
python3
import tensorflow as tf
tf.__version__
No error is reported, which means the installation is successful.
Other reference tutorials: https://blog.csdn.net/yihuajack/article/details/121234463