Install & Compatibility
Where this runs
tested against v2.11.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 69.15s
py 3.11
✕ build_error
1/2 runs
py 3.12
✕ build_error
1/2 runs
py 3.13
✕ build_error
1/2 runs
py 3.9
✕ build_error
1/2 runs
2867MB installed
● package 2867MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tensorflow
✓ import tensorflow as tf
✗ import tensorflow-gpu as tf
The package name is tensorflow, regardless of GPU or CPU. Use 'import tensorflow' and TF will automatically use GPU if available.
tf.test.is_gpu_available
✓ import tensorflow as tf; tf.config.list_physical_devices('GPU')
✗ tf.test.is_gpu_available()
is_gpu_available() is deprecated since TF 2.1.0 and removed in TF 2.11. Use tf.config.list_physical_devices('GPU') instead.
Basic GPU check and matrix multiplication.
import tensorflow as tf
import os
# Check GPU availability
physical_devices = tf.config.list_physical_devices('GPU')
if len(physical_devices) > 0:
print("GPU available:", physical_devices)
else:
print("No GPU found.")
# Simple matrix multiplication
import numpy as np
a = tf.constant(np.random.rand(1000, 1000))
b = tf.constant(np.random.rand(1000, 1000))
c = tf.matmul(a, b)
print("Result shape:", c.shape)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tensorflow-gpu'
The tensorflow-gpu package has been removed from PyPI since version 2.12.0.
fixUse 'import tensorflow' after installing 'tensorflow' (pip install tensorflow).
ImportError: cannot import name 'is_gpu_available' from 'tensorflow.python.client'
tf.test.is_gpu_available() was removed in TensorFlow 2.11.
fixUse tf.config.list_physical_devices('GPU') to check GPU availability. RuntimeError: The Session graph is empty. Add operations to the graph before calling run().
Legacy TF 1.x code using tf.Session() in TF 2.x with disabled v1 compatibility.
fixEnable TF 2.x behavior by default or rewrite using Keras API. Use tf.compat.v1 to retain v1 compatibility if necessary.
Upgrade
Version history
2.12.0latest on PyPI · released Jan 24, 2023
Audit
Dependencies
No dependency data recorded yet.