Official TensorFlow for Jetson AGX Xavier

Our official release of TensorFlow for Jetson AGX Xavier!

Python 3.8+JetPack5.x
Please check below document for the installation instructions:

Python 3.6+JetPack4.6.3

$ sudo apt-get update
$ 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
$ sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
$ sudo pip3 install -U numpy==1.19.4 future mock keras_preprocessing keras_applications gast==0.2.1 protobuf pybind11 cython pkgconfig packaging
$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v461 tensorflow

Python 3.6+JetPack4.5

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 numpy==1.16.1 future==0.18.2 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
# TF-2.x
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v45 tensorflow
# TF-1.15
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v45 ‘tensorflow<2’

Python 3.6+JetPack4.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’

Python 3.6+JetPack4.3

sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev
sudo apt-get install python3-pip
sudo pip3 install -U pip
sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta
# TF-2.x
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow==2.1.0+nv20.3
# TF-1.15
$ sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow==1.15.2+nv20.3

Python 3.6+JetPack4.2.1

sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.14.0+nv19.10

Python 3.6+JetPack4.2

sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu

Python 3.6+JetPack4.1.1

pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v411 tensorflow-gpu==1.13.0rc0+nv19.2 --user

Python 2.7+JetPack4.1.1

pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v411 tensorflow-gpu==1.13.0rc0+nv19.2 --user

If you meet error when installing h5py, please run this command to solve the dependency:

sudo apt-get install libhdf5-serial-dev hdf5-tools

DL frameworks - https://developer.nvidia.com/deep-learning-frameworks
Download - https://developer.nvidia.com/embedded/downloads#?search=tensorflow
Installation guide - https://docs.nvidia.com/deeplearning/dgx/install-tf-xavier/index.html
Release note - https://docs.nvidia.com/deeplearning/dgx/install-tf-xavier-release-notes/index.html

1 Like

The pip and pip3 are not installed in the jetpack 4.0EA. Please do:

sudo apt-get install python-pip

for pip
or

sudo apt-get install python3-pip

for pip3

Has anyone successfully used the TensorFlow Object Detection API with the Python3.6 version of TensorFlow for Jetson AGX Xavier?

I ran into a problem where the object_detection_tutorial Jupyter Notebook is really slow.

As example In[11] takes over a minute to complete.

For comparison the model_builder_test.py comes back with "Ran 22 tests in .901s

Both of the above were done without modifying the jetson clocks or performance modes.

Here is the process I used to install it

Fresh Install of Jetpack 4.1DP
Installed Tensorflow for Python 3.6
Used the following tutorial to install it (skipping steps 1 through 4).

One thing notable is Jupyter install using “python3 -m install jupyter” doesn’t seem to set any path to it. So typing “jupyter-notebook” just gives a command not found error.

So the way I used was typing “~/.local/bin/jupyter-notebook object_detection_tutorial.ipynb”

Hi, S4WRXTTCS

Maybe you can check this tutorial to see if any helps:
[url]https://github.com/NVIDIA-AI-IOT/tf_trt_models[/url]

Thanks.

Using optimized TensorFlow models accelerated with NVidia TensorRT would definitely be the way to go for proper evaluation of performance, but I figured the default TensorFlow object detection would work well enough for evaluation purposes with the assumption of 2-4x speed gains with TensorRT.

I also needed to install the default Tensorflow object detection in order to try object detection with distance estimation using the ZED Stereo Camera.

It is working, but it’s really slow as in probably less than a frame per second. The only thing I have to compare it against is a XEON workstation with a TitanV card, and even that doesn’t run so well.

It’s entirely possible that it’s a result of my install as the readme says to make sure the virtualenv is active, and I haven’t even tried out virtualenv yet. That’s going to be my next step. With the Jetson I used the default python3 environment, and with the Ubuntu workstation I used a single Anaconda environment.

Once I have things working properly with the standard TensorFlow Models I’ll have a good starting point to combine a TensorRT optimized object detection model with the Stereo Labs depth information.

They simply have two threads going on at once so I’m curious about how the Xavier will handle it.

I follow the instruction for install the tensorflow on JETSON AGX XAVIER but i can’t success complete the installation. here is the error message. Need help to solve the problem.

aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ytvI67/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DH5_USE_16_API -I./h5py -I/tmp/pip-build-wx7_AK/h5py/lzf -I/opt/local/include -I/usr/local/include -I/home/nvidia/.local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c /tmp/pip-build-wx7_AK/h5py/h5py/defs.c -o build/temp.linux-aarch64-2.7/tmp/pip-build-wx7_AK/h5py/h5py/defs.o
In file included from /home/nvidia/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
from /home/nvidia/.local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /home/nvidia/.local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/pip-build-wx7_AK/h5py/h5py/api_compat.h:26,
from /tmp/pip-build-wx7_AK/h5py/h5py/defs.c:654:
/home/nvidia/.local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " “#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION” [-Wcpp]
#warning "Using deprecated NumPy API, disable it by "
^~~~~~~
In file included from /tmp/pip-build-wx7_AK/h5py/h5py/defs.c:654:0:
/tmp/pip-build-wx7_AK/h5py/h5py/api_compat.h:27:10: fatal error: hdf5.h: No such file or directory
#include “hdf5.h”
^~~~~~~~
compilation terminated.
error: command ‘aarch64-linux-gnu-gcc’ failed with exit status 1

----------------------------------------

Command “/usr/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-wx7_AK/h5py/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-Zu44QE-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-wx7_AK/h5py/

Hi

I had the same error and tried the following commands according to the link https://ahmedibrahimvt.wordpress.com/2017/02/19/fatal-error-hdf5-h-no-such-file-or-directory/

sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11

then continue with the build commands provided by Nvidia

python 2.7

pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v411 tensorflow-gpu

or

python 3.6

pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v411 tensorflow-gpu

artemisl & chenyu36,

Did you install tensorflow-gpu with freshly flushed JetPack 4.1.1? If not, could you help to elaborate little more to reproduce the error?
Thanks!

Hi triston,

For me, there was JetPack 4.1 DP on Jetson Xavier before, then I flashed it to 4.1.1 DP.
Soon afterward, I tried to install python 2.7 tensorflow-gpu. The installation process failed with the message that artemisl posted.

chenyu36,

Thanks for the info. We will try to repro the issue and get it done ASAP. It looks like there is an issue to install numpy (and its dependencies).

Hi, artemisl & chenyu36

We can successfully install TensorFlow on JetPack4.1.1 with the command shared in #1.
h5py is automatically installed when we run the pip command.

......
Successfully installed absl-py-0.6.1 astor-0.7.1 backports.weakref-1.0.post1 funcsigs-1.0.2 futures-3.2.0 gast-0.2.0 grpcio-1.16.1 <b>h5py-2.8.0</b> keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 mock-2.0.0 pbr-5.1.1 protobuf-3.6.1 tensorboard-1.12.0 tensorflow-gpu-1.12.0rc2+nv18.11 termcolor-1.1.0 werkzeug-0.14.1

Maybe your issue is caused from different pip version.
Could you try to upgrade pip into latest and try it again?

sudo apt-get install python-pip
pip install -U pip

Thanks.

artemisl & chenyu36,

It will be very nice if you can share any feedback for AastaLLL’s comment (update pip).

Hi triston, AastaLLL,

Since my Tensorflow installation (using Nivida pip command above) worked after manually installing “libhdf5” as in my above post, my current setup may not be the ideal environment to test the “pip update” solution.

Maybe artemisl can give it a try if he hasn’t got his Tensorflow working.

Or, I can reflash my current setup back to 4.1.1 DP one more time, try the “pip update” solution next, but that’s going to take some time.

Thank you for your feedback chenyu36! Glad to hear that Tensorflow is working on your Xavier.

Dear Chenyu36 and triston,

I am very sorry for late. Today I try to reflash the Xavier again with JetPack 4.1.1DP
and follow the instruction form
https://docs.nvidia.com/deeplearning/dgx/install-tf-xavier/index.html

The tensorflow installation problem is solved.

But, it seems got the new trouble. When Verifying The Installation, i got the error message
“ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory”

I download the “cuDNN Library for Linux” form
https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.4.1.5/prod/10.0_20181108/cudnn-10.0-linux-x64-v7.4.1.5.tgz

and follow the error message form Build and install error messages  |  TensorFlow
do the following action

$ tar xvzf cudnn-10.0-linux-x64-v7.4.1.5.tgz
$ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

$ vim ~/.bashrc

export LD_LIBRARY_PATH=“$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64”
export CUDA_HOME=/usr/local/cuda

The Error message “ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory” still exist

I am very thank you for your answers

nvidia@jetson-0423618000766:~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow
Traceback (most recent call last):
File “”, line 1, in
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/init.py”, line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/init.py”, line 49, in
from tensorflow.python import pywrap_tensorflow
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “/home/nvidia/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.

See Создание и установка сообщений об ошибках  |  TensorFlow

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

Successfully installed absl-py-0.6.1 astor-0.7.1 backports.weakref-1.0.post1 enum34-1.1.6 funcsigs-1.0.2 futures-3.2.0 gast-0.2.0 grpcio-1.16.1 h5py-2.8.0 keras-applications-1.0.6 keras-preprocessing-1.0.5 markdown-3.0.1 mock-2.0.0 numpy-1.15.4 pbr-5.1.1 protobuf-3.6.1 setuptools-40.6.2 six-1.11.0 tensorboard-1.12.0 tensorflow-gpu-1.12.0rc2+nv18.11 termcolor-1.1.0 werkzeug-0.14.1 wheel-0.32.3

Is there a version for DRIVE AGX as well?

@artemisl,
With fresh login, what does following commands return?

ls -la /usr/lib/aarch64-linux-gnu/libcu*
ldconfig -p
update-alternatives --display libcudnn

This package is only for Jetson AGX Xavier currently.
Thanks.