[Play with Jetson TX2 NX] (4) Install TensorFlow GPU on TX2 NX (detailed tutorial + error resolution)

1 About the update source

The information provided by the seller does not recommend changing the source, the reason: Jetson TX2 NX uses the Ubuntu 18.04.2 LTS system with aarch64 architecture, which is different from the Ubuntu system with AMD architecture, and no perfect domestic source has been found, so it is not recommended to change the source.

I didn't change the source, but the speed of installing some libraries is ok, first do the following

sudo apt-get update

as the picture shows:

insert image description here
Then, execute the following command

sudo apt-get full-upgrade

as the picture shows:

insert image description here
During the command execution process, this window pops up, I directly choose No to continue:

insert image description here
You can enter commands to view CUDA

nvcc -V

as the picture shows:

insert image description here
To check Opencv, first enter the command

python

Then enter the following python code

import cv2
cv2.__version__

You can see the Opencv version number, and then enter the exit command

exit()

as the picture shows:

insert image description here
Test the onboard camera, write commands

nvgstcapture-1.0

as the picture shows:

insert image description here
Enter q directly and press Enter to turn off the camera:

insert image description here

2 Jetson TX2 NX Install TensorFlow GPU

Install the pip command as follows

sudo apt-get install python3-pip python3-dev

The installation may fail due to network reasons, try several times, as shown in the figure:

insert image description here
To upgrade pip, enter the command

python3 -m pip install --upgrade pip

as the picture shows:

insert image description here
Install the numpy package, enter the command

sudo apt-get install python3-numpy

as the picture shows:

insert image description here
Install the scipy package, enter the command

sudo apt-get install python3-scipy

as the picture shows:

insert image description here
Install the pandas package, enter the command

sudo apt-get install python3-pandas

as the picture shows:

insert image description here
Install the matplotlib package, enter the command

sudo apt-get install python3-matplotlib

as the picture shows:

insert image description here
Install the sklearn package, enter the command

sudo apt-get install python3-sklearn

as the picture shows:

insert image description here
Install the libhdf5-serial-dev package, enter the command

sudo apt-get install libhdf5-serial-dev

as the picture shows:

insert image description here

Install the hdf5-tools package, enter the command

sudo apt-get install hdf5-tools

as the picture shows:

insert image description here

Install the libhdf5-dev package, enter the command

sudo apt-get install libhdf5-dev

as the picture shows:

insert image description here

Install the zlib1g-dev package, enter the command

sudo apt-get install zlib1g-dev

as the picture shows:

insert image description here

Install the zip package, enter the command

sudo apt-get install zip

as the picture shows:

insert image description here

Install the libjpeg8-dev package, enter the command

sudo apt-get install libjpeg8-dev

as the picture shows:

insert image description here

Install the liblapack-dev package, enter the command

sudo apt-get install liblapack-dev

as the picture shows:

insert image description here

Install the libblas-dev package, enter the command

sudo apt-get install libblas-dev

as the picture shows:

insert image description here

Install the gfortran package, enter the command

sudo apt-get install gfortran

as the picture shows:

insert image description here
Install TensorFlow GPU offline, copy the installation file to Jetson TX2 NX directly using a USB flash drive, and then execute the installation command

pip3 install tensorflow-2.1.0+nv20.4-cp36-cp36m-linux_aarch64.whl

The following errors may occur. The reason for the error is that the connection is interrupted when downloading some packages:

insert image description here

Solution: Since some software packages will be installed during the installation process, in order to improve the download speed and stability, now change the source for pip

Pip permanently changes the source, enter the following command to create .pip

mkdir ~/.pip

Then create a pip.conf file and enter the command

vim ~/.pip/pip.conf

After entering, press ito enter edit mode and copy the Tsinghua source below

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

Then press ESCexit, press :wqsave to exit

Then execute the installation command, as shown in the figure:

insert image description here
An error is reported when installing the h5py package, as shown in the figure:

insert image description here
Tried many solutions on the Internet, none of which worked, and finally installed the h5py package by entering the following command

sudo apt install python3-h5py

as the picture shows:

insert image description here
Keras is an advanced neural network API written in Python, the installation command is as follows

sudo pip3 install keras

as the picture shows:

insert image description here
I hope this article is helpful to everyone. If there is anything wrong with the above, please correct me.

Sharing determines the height, and learning widens the gap

Guess you like

Origin blog.csdn.net/qq_42078934/article/details/129635721