Running Python 3.10 + Tensorflow with GPU support inside a container


I’m trying to extend the image with Python 3.10. Our codebase relies on Python 3.10, and rewriting and updating the dependencies to make them compatible with the Jetson Orin NX would be a pain in the ass.

I have installed Python 3.10 from the deadsnakes ppa and Tensorflow 2.11 from the jetpack index. However, when I attempt to list the GPU devices using the custom Tensorflow installation, it returns an empty list.

How can i install Tensorflow inside a L4T Tensorflow container?
Using the +nv images throws the following error, and using a normal TF version from that repo doesn’t seem to have GPU support.

python -m pip install
ERROR: tensorflow-2.11.0+nv23.03-cp38-cp38-linux_aarch64.whl is not a supported wheel on this platform.

Important note about python and python3 commands:

  • python is Python 3.10
  • python3 is the default Python (Python 3.8)

Python 3.8 (Default)

docker run -it --rm --gpus all --runtime nvidia orin:latest python3 -c 'import tensorflow as tf; print(tf.__version__, tf.config.list_physical_devices("gpu"))'
2.11.0 [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

Python 3.10

docker run -it --rm --gpus all --runtime nvidia orin:latest python3 -c 'import tensorflow as tf; print(tf.__version__, tf.config.list_physical_devices("gpu"))'
2.11.0 []

Other Info:

cat /etc/nv_tegra_release
# R35 (release), REVISION: 3.1, GCID: 32827747, BOARD: t186ref, EABI: aarch64, DATE: Sun Mar 19 15:19:21 UTC 2023

Custom Dockerfile:


# Add deadsnakes repo
RUN apt update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa -y

# Install Python 3.10
RUN apt update && apt install -y python3.10 python3.10-distutils
RUN curl -sS | python3.10

# Replace python shell with python3.10
RUN unlink /usr/bin/python
RUN ln -s /usr/bin/python3.10 /usr/bin/python

RUN python -m pip install --pre --extra-index-url tensorflow==2.11

@jorge.ruiz1 those TensorFlow wheels for are built for Python 3.8, and you would need to compile TensorFlow from source for Python 3.10 to get GPU acceleration in it. I haven’t personally done that before with TensorFlow, but you may find some other folks who have in posts around the forums here.

@dusty_nv I have tried building TF with the tensorflow/tensorflow:devel-gpu container with cross compilation for arm64 but i end up getting an unexpected error. :|

As the core maintainer of the L4T containers, do you have any idea when the containers base image will be upgraded (To 22.04 or 24.04), as those versions ditch python 3.8 which reaches EOL in ~14 months

I was able to build tensorflow-2.14.0-cp310-cp310-linux_aarch64.whl with full gpu support. But on a jetson orin nx upgraded to ubuntu 22.04 with gcc-12 gcc-9 and nvcc. Therefor the dependencies might not fit a container build.

Hi @jorge.ruiz1 the l4t containers will be upgraded to 22.04 along with JetPack 6:

That’s cool to hear that CUDA/NVCC/ect still works after you manually upgraded to 22.04!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.