{"id":7778,"library":"tensorflow-aarch64","title":"TensorFlow for AArch64","description":"TensorFlow for AArch64 is an open-source machine learning framework providing a flexible architecture for high-performance numerical computation on ARM 64-bit systems. Since TensorFlow 2.10, official Linux CPU builds for AArch64/ARM64 processors are built, maintained, tested, and released by a third-party collaboration including AWS, ARM, and Linaro. The current version is 2.16.1. It follows the main TensorFlow release cadence.","status":"active","version":"2.16.1","language":"en","source_language":"en","source_url":"https://github.com/tensorflow/tensorflow","tags":["machine-learning","deep-learning","neural-network","ml","aarch64","arm64","gpu","cpu","tensorflow"],"install":[{"cmd":"pip install tensorflow-aarch64","lang":"bash","label":"Install CPU-only version"},{"cmd":"pip install tensorflow-aarch64 tensorflow_io","lang":"bash","label":"Install with TensorFlow I/O (often useful)"}],"dependencies":[{"reason":"Fundamental for numerical operations.","package":"numpy","optional":false},{"reason":"High-level API for building and training models. Note that starting with TF 2.16, Keras 3 is the default.","package":"keras","optional":false},{"reason":"Abseil Python Common Libraries.","package":"absl-py","optional":false},{"reason":"Used for serializing structured data.","package":"protobuf","optional":false},{"reason":"Visualization toolkit for TensorFlow.","package":"tensorboard","optional":false},{"reason":"Enables GCS filesystem support. Optional since TF 2.21, install explicitly if needed.","package":"tensorflow-io-gcs-filesystem","optional":true},{"reason":"For NVIDIA GPU support (requires compatible CUDA Toolkit installation).","package":"nvidia-cuda-runtime-cu12","optional":true},{"reason":"For NVIDIA GPU support (requires compatible cuDNN installation).","package":"nvidia-cudnn-cu12","optional":true}],"imports":[{"symbol":"tensorflow","correct":"import tensorflow as tf"}],"quickstart":{"code":"import tensorflow as tf\n\nprint(\"TensorFlow version:\", tf.__version__)\n\n# Check for GPU devices (will be empty if only CPU is available)\ngpus = tf.config.list_physical_devices('GPU')\nif gpus:\n    print(f\"Detected GPUs: {gpus}\")\nelse:\n    print(\"No GPU devices found.\")\n\nmnist = tf.keras.datasets.mnist\n(x_train, y_train), (x_test, y_test) = mnist.load_data()\nx_train, x_test = x_train / 255.0, x_test / 255.0\n\nmodel = tf.keras.models.Sequential([\n    tf.keras.layers.Flatten(input_shape=(28, 28)),\n    tf.keras.layers.Dense(128, activation='relu'),\n    tf.keras.layers.Dropout(0.2),\n    tf.keras.layers.Dense(10)\n])\n\nloss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)\nmodel.compile(optimizer='adam', loss=loss_fn, metrics=['accuracy'])\n\nprint(\"\\nTraining model...\")\nmodel.fit(x_train, y_train, epochs=1)\n\nprint(\"\\nEvaluating model...\")\nmodel.evaluate(x_test, y_test, verbose=2)\n","lang":"python","description":"This quickstart demonstrates a simple image classification task using the MNIST dataset and TensorFlow's Keras API. It also includes checks for TensorFlow version and available GPU devices."},"warnings":[{"fix":"Ensure you are using the officially provided `tensorflow-aarch64` package from PyPI. If you previously used a custom build, consider migrating to the official package for better support and compatibility. Verify source via `pip show tensorflow-aarch64`.","message":"Starting with TensorFlow 2.10, Linux CPU-builds for Aarch64/ARM64 processors are built, maintained, and released by a third party (AWS). This change might affect users who relied on previous community-built `tensorflow-aarch64` packages.","severity":"breaking","affected_versions":">=2.10"},{"fix":"Always check the official TensorFlow installation guide for the exact Python version compatibility for your desired TensorFlow version. Use a Python virtual environment to manage dependencies and avoid conflicts.","message":"TensorFlow has specific Python version requirements. TensorFlow 2.16.1 requires Python >=3.9. Future versions (e.g., TF 2.21) will remove support for Python 3.9.","severity":"breaking","affected_versions":"All versions"},{"fix":"To explicitly use Keras 2.0, install `tf-keras` via `pip install tf-keras~=2.16` and change your imports from `import tensorflow.keras as keras` to `import tf_keras as keras`.","message":"The default Keras version in TensorFlow 2.16 and later is Keras 3.0. If your existing code relies on Keras 2.0 specific behaviors or APIs, it might break.","severity":"gotcha","affected_versions":">=2.16"},{"fix":"Use `isinstance(t, tf.Tensor)` for robust type checking, as recommended by TensorFlow documentation.","message":"When checking the type of a TensorFlow tensor, relying on exact type checking (e.g., `type(t) == tf.Tensor`) might fail due to changes in class hierarchy (explicit `EagerTensor` and `SymbolicTensor` classes).","severity":"gotcha","affected_versions":">=2.18"},{"fix":"As a workaround, try setting the `LD_PRELOAD` environment variable: `export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1` before running your TensorFlow application. The exact path to `libgomp.so.1` may vary slightly depending on your distribution.","message":"Some AArch64 systems may encounter `cannot allocate memory in static TLS block` errors related to `libgomp` when running TensorFlow.","severity":"gotcha","affected_versions":"All versions (system-dependent)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Upgrade your `libstdc++6` package. For Ubuntu/Debian, this might involve adding a newer toolchain repository and upgrading: `sudo add-apt-repository ppa:ubuntu-toolchain-r/test && sudo apt update && sudo apt install --only-upgrade libstdc++6`.","cause":"The installed `libstdc++` library is older than what TensorFlow requires, often seen on older Linux distributions.","error":"ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found"},{"fix":"1. Ensure you have a 64-bit Python (`python3 -c 'import sys; print(sys.maxsize > 2**32)'` should output `True`). 2. Check your Python version against TensorFlow's requirements (e.g., TF 2.16.1 requires >=3.9). 3. Upgrade pip: `python3 -m pip install --upgrade pip`.","cause":"This typically means your Python version is incompatible with the available `tensorflow-aarch64` wheels on PyPI, or your `pip` is outdated, or you are on an unsupported AArch64 variant.","error":"ERROR: Could not find a version that satisfies the requirement tensorflow-aarch64 (from versions: none)"},{"fix":"1. Verify NVIDIA drivers are installed and up-to-date (`nvidia-smi`). 2. Ensure your CUDA Toolkit and cuDNN versions are compatible with your TensorFlow version (check official TensorFlow GPU installation guide). 3. Set necessary environment variables, especially `LD_LIBRARY_PATH` to include CUDA library paths. You might also need to downgrade TensorFlow or CUDA if versions are incompatible.","cause":"TensorFlow cannot detect an NVIDIA GPU, often due to incompatible CUDA Toolkit/cuDNN versions, missing NVIDIA drivers, or incorrect environment setup (e.g., `LD_LIBRARY_PATH`).","error":"failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected"},{"fix":"Install the HDF5 development libraries: `sudo apt-get install libhdf5-dev` (for Debian/Ubuntu) or equivalent for your distribution. Then retry the `pip install` command.","cause":"During `pip install`, `h5py` (a common dependency) fails to build from source because necessary HDF5 development libraries are missing on the system.","error":"ERROR: Failed building wheel for h5py"}]}