{"id":7779,"library":"tensorflow-cpu-aws","title":"TensorFlow CPU (AWS ARM64 optimized)","description":"TensorFlow is an open-source machine learning framework. The `tensorflow-cpu-aws` package is a distribution of TensorFlow specifically optimized for CPU (ARM64/Aarch64) architectures, built and maintained by AWS. It is typically installed automatically as a dependency when the generic `tensorflow` package is installed on an ARM-based system. The current version is 2.15.1, and its release cadence generally aligns with the main TensorFlow releases.","status":"active","version":"2.15.1","language":"en","source_language":"en","source_url":"https://github.com/tensorflow/tensorflow","tags":["machine-learning","tensorflow","aws","arm64","aarch64","cpu-only"],"install":[{"cmd":"pip install tensorflow-cpu-aws","lang":"bash","label":"Direct installation (ARM64/Aarch64)"},{"cmd":"pip install tensorflow","lang":"bash","label":"Indirect installation (on ARM64/Aarch64 systems, this package will be installed)"}],"dependencies":[{"reason":"This package is a specific build of TensorFlow for ARM64/Aarch64 CPUs and is often a dependency resolved when 'tensorflow' is installed on compatible systems.","package":"tensorflow","optional":false}],"imports":[{"symbol":"tensorflow","correct":"import tensorflow as tf"},{"symbol":"keras","correct":"from tensorflow import keras"}],"quickstart":{"code":"import tensorflow as tf\n\n# Verify TensorFlow installation and basic operation\nprint(\"TensorFlow version:\", tf.__version__)\nprint(\"Is GPU available:\", tf.config.list_physical_devices('GPU'))\n\n# Create a simple constant tensor\nhello = tf.constant('Hello from TensorFlow-CPU-AWS!')\nprint(hello.numpy().decode('utf-8'))\n\n# Perform a basic operation\na = tf.constant(10)\nb = tf.constant(32)\nprint(\"a + b =\", tf.add(a, b).numpy())\n\n# Example with Keras (MNIST dataset)\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\npredictions = model(x_train[:1]).numpy()\nprint(\"Sample predictions shape:\", predictions.shape)","lang":"python","description":"This quickstart demonstrates how to import TensorFlow, verify its version and device availability (which should show only CPU devices for this package), and perform a basic tensor operation. It also includes a simple Keras model definition and a forward pass, illustrating typical usage for a CPU-only environment."},"warnings":[{"fix":"Check PyPI for the exact `tensorflow-cpu-aws` version available. If there's a mismatch, you might need to pin the `tensorflow` version to one compatible with the latest `tensorflow-cpu-aws` release or wait for an updated `tensorflow-cpu-aws` package.","message":"For TensorFlow versions 2.16 and later, the `tensorflow` package's metadata has sometimes incorrectly specified a tight dependency on a `tensorflow-cpu-aws` version (e.g., `tensorflow-cpu-aws==2.16.1`) that might not yet be released. This can lead to dependency resolution failures during installation on ARM64/Aarch64 machines.","severity":"breaking","affected_versions":">=2.16.0"},{"fix":"If on an x86_64 machine, install `tensorflow` or `tensorflow-cpu` (often resolved to `tensorflow-intel` on Windows/Intel Linux) instead. On ARM64/Aarch64, `pip install tensorflow` will typically pull in `tensorflow-cpu-aws` automatically.","message":"The `tensorflow-cpu-aws` package is specifically compiled for ARM64/Aarch64 processors. Attempting to install this package directly on an x86_64 architecture will result in a 'No matching distribution found' error, as compatible wheels are not available for that platform.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to an EC2 instance type with more memory and CPU (e.g., `c5` or `m5` families for CPU-intensive tasks). Ensure sufficient disk space as well. When installing, `pip install tensorflow-cpu --no-cache-dir` might help if cache-related disk space is an issue.","message":"Running TensorFlow on under-provisioned AWS EC2 instances (e.g., free-tier `t2.micro`) can lead to `ResourceExhaustedError: OOM when allocating tensor` or the `pip install` process being 'killed' due to insufficient RAM or CPU.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly configure TensorFlow's inter-op and intra-op parallelism threads using `tf.config.threading.set_inter_op_parallelism_threads()` and `tf.config.threading.set_intra_op_parallelism_threads()` to match your instance's core count.","message":"TensorFlow may not fully utilize all available CPU cores on multi-core instances by default, potentially leading to lower-than-expected performance.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"On x86_64, use `pip install tensorflow` or `pip install tensorflow-cpu`. If on an ARM64/Aarch64 system, this error can also occur if the specific version requested is not yet available, or if Python version compatibility is an issue. Ensure your Python version (>=3.9) is supported.","cause":"Attempting to install `tensorflow-cpu-aws` directly on an x86_64 system where only ARM64/Aarch64 wheels are available.","error":"ERROR: Could not find a version that satisfies the requirement tensorflow-cpu-aws (from versions: none)"},{"fix":"Increase the memory and CPU resources of your AWS EC2 instance. Review your model architecture and batch sizes; reduce them if possible. Ensure your dataset fits into memory.","cause":"The TensorFlow operation attempted to allocate more memory than available on the CPU, common in under-provisioned environments like smaller AWS EC2 instances.","error":"tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape [...] and type float on /job:localhost/replica:0/task:0/device:CPU:0 by allocator cpu"},{"fix":"Use an AWS EC2 instance with more memory. Consider using `pip install --no-cache-dir tensorflow-cpu-aws` to reduce temporary disk usage during installation.","cause":"The `pip install` process was terminated by the operating system, typically due to running out of memory (OOM killer) or other resource constraints on the host machine (e.g., an AWS EC2 instance).","error":"Killed"}]}