Adding tensorflow to Orbitty + Nvidia Jetson TX2 container

I’m trying to add python 3.6, pip3 and tensorflow 1.13.1 to an Orbitty + Nvidia Jetson TX2 container.

Instructions: https://devtalk.nvidia.com/default/topic/1038957/jetson-tx2/tensorflow-for-jetson-tx2-/

pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42  tensorflow-gpu==1.13.1+nv19.5 --user

Unfortunately, the “resin/orbitty-tx2-debian:stretch” base container has python 3.5.3. Perhaps I should switch to the latest balena version. Instead I tried:

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3-dev \
    && python3 --version

but that is still Python 3.5.3. How do I get Python 3.6?

I switched to “balenalib/jetson-tx2-debian-python:3.6.8-build” and was able to install tensorflow but I still need to solve this error:

# python3
Python 3.6.8 (default, Jan 12 2019, 04:57:27) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "/root/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/root/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/root/.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/local/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/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 "/root/.local/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/root/.local/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/root/.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 "/root/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/root/.local/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/root/.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/local/lib/python3.6/imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/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.

ah, looks like I need to install CUDA 10:

/usr/local/cuda-9.0/doc/man/man7/libcublas.so.7
/usr/local/cuda-9.0/doc/man/man7/libcublas.7
/usr/local/cuda-9.0/targets/aarch64-linux/lib/libcublas.so.9.0.252
/usr/local/cuda-9.0/targets/aarch64-linux/lib/stubs/libcublas.so
/usr/local/cuda-9.0/targets/aarch64-linux/lib/libcublas_device.a
/usr/local/cuda-9.0/targets/aarch64-linux/lib/libcublas.so.9.0
/usr/local/cuda-9.0/targets/aarch64-linux/lib/libcublas.so
/usr/local/cuda-9.0/targets/aarch64-linux/lib/libcublas_static.a

Hey Jason,

Great to see you’re making progress. Let us know if you still need any help!