This is the last version of Tensorflow 2 compatible with Ubuntu 20.04 on Jetpack 5.1 (i.e. not requiring newer numpy than is the system-installed one).
Installation instructions
# From https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#install
sudo apt install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran
# Install our custom wheel instead of the NVidia-provided one
# It will spend a lot of time building grpcio, but don't be afraid.
pip3 install --user https://github.com/ctu-vras/tensorflow/releases/download/v2.7.4-jp51/tensorflow-2.7.4-cp38-cp38-linux_aarch64.whl
Build instructions for the Python Wheel (not usually needed)
git clone https://github.com/ctu-vras/tensorflow -b v2.7.4-jp51 --depth=1
wget https://github.com/bazelbuild/bazelisk/releases/download/v1.20.0/bazelisk-linux-arm64
ln -s bazelisk-linux-arm64 bazel
export PATH=`pwd`:$PATH
cd tensorflow
./configure # mostly follow the default prompts; set compute archs 7.2,8.7 (Xavier AGX + Orin AGX); set optimization flags to -Wno-sign-compare -march=armv8.2-a -O3
pip3 install --user keras_preprocessing==1.0.9 # version 1.1+ has a problem with readline library
bazel build //tensorflow/tools/pip_package:build_pip_package --repo_env=WHEEL_NAME=tensorflow --config=cuda # loooong time
bazel-bin/tensorflow/tools/pip_package/build_pip_package ../tensorflow-whl
# The wheel is in ../tensorflow-whl/tensorflow-2.7.4-cp38-cp38-linux_aarch64.whl