This article has participated in the “new creative Ceremony” activity

Matters needing attention

1) When the operating system image is just burned in, the language must be selected in English. If you choose Chinese, problems like “Build wheel Error” may occur. 2) Use the jetson Nano download source as much as possible and don’t make unnecessary changes. If a package really needs to be switched, it is recommended to switch only when the package is suitable for downloading. 3) Make sure your name is on jetson Nano before downloading the package. For example, anaconda will be installed differently in jetson Nano. 4) Do not download the dependent packages of TensorFlow such as Numpy before downloading TensorFlow to avoid problems caused by version conflicts.

If you unfortunately encountered the above problems, to correct as far as possible to correct, if not correct had to re-burn.

Install tensorfow

Note that The Tensorflow of Jetson Nano can be downloaded according to the official website. Cuda-10.2 and CUDA10 come with my Jetson Nano. The second method is the official website. Official TensorFlow for Jetson Nano!

The preparatory work

1. Check the Ubuntu version

cat /etc/issue
Copy the code

or

lsb_release -a
Copy the code

2. Check the cuda

cat /usr/local/cuda/version.txt
Copy the code

Jetson Nano comes with its own CUDA. First, you need to find the folder where your CUDA is located to check the version of your CUDA. My version here is CUDa10, but all the configuration environment variables online use CUDa10.0. Therefore, be sure to see it clearly before configuration

Write cudA that matches your board to the environment variable

sudo gedit  ~/.bashrc
Copy the code

Fill in at the end of the open file

export CUDA_HOME=/usr/local/cuda-10
export LD_LIBRARY_PATH=/usr/local/cuda-10/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10/bin:$PATH
Copy the code

(Note: the name of cuda10 is cuda10, not cuda10.0, and the name of the cuda10 folder must be the same.)

Save and execute

source ~/.bashrc
Copy the code

3. Modify the PIP

sudo apt-get update
sudo apt-get full-upgrade
sudo apt-get install python3-pip python3-dev
python3 -m pip install --upgrade pip  # upgrade PIP
sudo gedit /usr/bin/pip3   Open the pip3 file
Copy the code

The original

from pip import main
if __name__ == '__main__':
    sys.exit(main())
Copy the code

Instead of

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())
Copy the code

Methods a

sudo apt-get install python3-pip libhdf5-serial-dev hdf5-tools pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow - gpu = = 1.13.1 + nv19.3 - userCopy the code

Method 2 (official website method)

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 testResources setuptools==49.6.0 sudo pip3 install -u Mock ==3.0.5 H5PY ==2.10.0 keras_preprocessing==1.1.1 keras_Applications ==1.0.8 gast==0.2.2 futures protobuf pybind11 sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v45 tensorflowCopy the code

Methods three

# 2. Install dependency packages. Many dependency packages need to be installed due to the use of a newly mirrored board.sudo apt-get install python3-scipy sudo apt-get install python3-pandas sudo apt-get install python3-sklearn sudo apt-get  install libhdf5-serial-dev hdf5-toolsIf the network is good, you can skip this stepsudo pip3 install Cython -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com sudo pip3 install Absl-py ==0.7.0 sudo pip3 install gast==0.2.2 sudo pip3 install Protobuf ==3.11.2 sudo pip3 install wrapt==1.11.2 sudo Pip3 install astor==0.8.1 sudo pip3 install Google -pasta==0.1.8 sudo pip3 install keras - I http://pypi.douban.com/simple/ - trusted - host pypi.douban.com sudo pip3 install grpcio - 1.26.0. Tar. Gz sudo pip3 install - extra - index - url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow - gpu = = 1.14.0 + nv19.10Copy the code

Note: All commands with sudo must be run as an administrator

It takes a little longer to wait because you are not switching to a domestic mirror source, but it is worth it in case of an error. If the timeout is sometimes due to network problems, you can try several times first.

Segmentation fault (core dumped)

>>> import tensorflow as tf
Segmentation fault (core dumped)
Copy the code

If this happens, there are two possibilities for the blogger: 1. The scipy version is not suitable in which case you can uninstall and reinstall it

sudo pip uninstall scipy
sudo apt-get install python3-scipy 
Copy the code

2. Cudnn or CUDA configuration problems Check whether CUDNN is installed and whether CUDA environment variables are correct. Select the appropriate version of CUDNN (note that aarch is the required version for Jetson Nano) then select cudNN Library for Linux and run the following command to copy the files to cudA files

# copy cudNN header file
sudo cp cuda/include/* /usr/local/ cuda - 10.0 / include /# Copy cudNN libraries
sudo cp cuda/lib64/* /usr/local/ cuda - 10.0 / lib64 /Add executable permission
sudo chmod +x /usr/local/cuda-10.0/include/cudnn.h
sudo chmod +x /usr/local/ cuda - 10.0 / lib64 / libcudnn *Copy the code

Verify success

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
Copy the code

If no error is reported, success is achieved

Missing issues such as libcublas.so.10.0

Libcublas.so.10.0, libcudart.so.10.0, libcusolver.so.

cd /usr/local/cuda-10/lib64 sudo cp libcublas.so.10.0 sudo cp libcublas.so.10.0 sudo cp libcublas.so.10.0 sudo cp 10 libcusolver libcusolver. So.. So. 10.0Copy the code

Illegal Instruction (core DUMPED

Python > import tensorflow: Illegal instruction(core dumped)

1) Open bashrc file

sudo gedit ~/.bashrc
Copy the code

2) Add in the last line of bashrc

export OPENBLAS_CORETYPE=ARMV8
Copy the code

3) Save the changes to bashrc. 4) If you want the changes to take effect immediately, type the following command

source ~/.bashrc
Copy the code

You can install some required packages, such as PIL

sudo pip install pillow
Copy the code