[PYTHON] Jetson Nano JETPACK 44.1 (2020/10/21) with Tensorflow

Introduction (Abstract)

Jetson Nano JETPACK 44.1 has installed cuda Library 10.2. And I tried to install tensorflow with 'python3 -m pip', but it was not working properly. Finally, I can make tensowflow working with gpu by other install index.

Problem

I download the SD card image file from Nvidia Jetson Download Center and follow the instruction and installed L4T 44.1 on my Jetson Nano.

Then, I tried install tensorflow for python:

$ python3 -m pip install --upgrade pip
$ python3 -m pip install tensorflow-gpu

Next, I opend python3 interactive mode, try import tensorflow:

$ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.python.client import device_lib

But, it did not finish successfully:

Traceback (most recent call last):
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/tri/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

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

I thought that the problem occured by this tensorflow version required the cuda 10.0, but L4T 44.1 has cuda 10.2, the reference version is different. I investigated it because I thought it was because it tried to refer to the illegal version.

Investigation I found a site which is written about Jetson Nano and Tensowflow installation. In this site information, the 4th Item, the author wrote about the dedicated version for Jetson Nano. So I accessed that site and found v44 directory.But,IfoundsomeTensorflow~.whlfiles.Whichisthebestone?CheckthedocumentaboutJetPackSDK, I decided to use Tensorflow 2.x. and to try the newest version.

$ python3 -m pip install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow==2.3.1

Then, try with Python3:

$ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
2020-12-28 17:02:48.297018: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2

Yeah! I got a success.

And try to list_local_devices():

>>> from tensorflow.python.client import device_lib
>>> device_lib.list_local_devices()
2020-12-28 17:04:10.089230: W tensorflow/core/platform/profile_utils/cpu_utils.cc:108] Failed to find bogomips or clock in /proc/cpuinfo; cannot determine CPU frequency
2020-12-28 17:04:10.090292: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x37c6caf0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-12-28 17:04:10.090373: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-12-28 17:04:10.112908: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2020-12-28 17:04:10.233309: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:10.233678: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x36c08980 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-12-28 17:04:10.233746: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): NVIDIA Tegra X1, Compute Capability 5.3
2020-12-28 17:04:10.235468: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:10.236124: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1742] Found device 0 with properties: 
pciBusID: 0000:00:00.0 name: NVIDIA Tegra X1 computeCapability: 5.3
coreClock: 0.9216GHz coreCount: 1 deviceMemorySize: 3.86GiB deviceMemoryBandwidth: 194.55MiB/s
2020-12-28 17:04:10.236236: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2
2020-12-28 17:04:10.253989: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2020-12-28 17:04:10.271843: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2020-12-28 17:04:10.278697: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2020-12-28 17:04:10.297505: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2020-12-28 17:04:10.309289: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.10
2020-12-28 17:04:10.311692: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2020-12-28 17:04:10.311971: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:10.312283: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:10.312368: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1884] Adding visible gpu devices: 0
2020-12-28 17:04:10.313306: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2
2020-12-28 17:04:13.541741: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1283] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-12-28 17:04:13.542731: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1289]      0 
2020-12-28 17:04:13.542820: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1302] 0:   N 
2020-12-28 17:04:13.549035: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:13.550273: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1046] ARM64 does not support NUMA - returning NUMA node zero
2020-12-28 17:04:13.552152: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1428] Created TensorFlow device (/device:GPU:0 with 61 MB memory) -> physical GPU (device: 0, name: NVIDIA Tegra X1, pci bus id: 0000:00:00.0, compute capability: 5.3)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 5071338378085176143
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 5701248517285533579
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 3113596419989883465
physical_device_desc: "device: XLA_GPU device"
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 64991232
locality {
  bus_id: 1
  links {
  }
}
incarnation: 10370280253443219495
physical_device_desc: "device: 0, name: NVIDIA Tegra X1, pci bus id: 0000:00:00.0, compute capability: 5.3"
]

Conclusion Tensorflow installation on Jetson Nano L4T 44.1 (2020/10/21) (For Python3.6.9)

$ python3 -m pip install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v44 tensorflow==2.3.1

Recommended Posts

Jetson Nano JETPACK 44.1 (2020/10/21) with Tensorflow
Use PX-S1UD / PX-Q1UD with Jetson nano
Run the original YOLO with Jetson Nano
jetson nano setup
Zundokokiyoshi with TensorFlow
Breakout with Tensorflow
Reading data with TensorFlow
Kyotei forecast with TensorFlow
Set up Jetson nano
Try regression with TensorFlow
Easy face recognition try with Jetson Nano and webcam
Translate Getting Started With TensorFlow
Try deep learning with TensorFlow
Use TensorFlow with Intellij IDEA
How to use Realsense's Python wrapper PyRealsense with Jetson Nano
Approximate sin function with TensorFlow
Use chainer with Jetson TK1
Easy image classification with TensorFlow
Stock price forecast with tensorflow
Try TensorFlow MNIST with RNN
TensorFlow 2.2 can't be installed with Python 3.8!
MNIST (DCNN) with Keras (TensorFlow backend)
Customize Model / Layer / Metric with TensorFlow
Inference & result display with Tensorflow + matplotlib
Classify "Wine" with TensorFlow MLP code
Precautions when installing tensorflow with anaconda
[TensorFlow 2] Learn RNN with CTC Loss
Try deep learning with TensorFlow Part 2
[TensorFlow] [Keras] Neural network construction with Keras
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
Try data parallelism with Distributed TensorFlow
Recognize USB devices with LicheePi Nano
Zura predicting today's temperature with TensorFlow
Intellisense doesn't work with tensorflow2.0 + VScode
Achieve pytorch reflection padding with Tensorflow