Install & Compatibility
Where this runs
tested against v2.21.0a20251023 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.002s · 147.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 7.2s · import 0.000s · 162MB
160MB installed
● package 160MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SummaryWriter
✓ from tensorboard import summary
✗ from torch.utils.tensorboard import SummaryWriter
This quickstart demonstrates how to train a simple Keras model and log its metrics and histograms to TensorBoard using the TensorBoard callback. After the script runs, it prints a command to launch the TensorBoard web interface to visualize the training process.
import datetime
import os
import tensorflow as tf
# Create a simple Keras model.
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
def create_model():
return tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10, activation='softmax')
])
model = create_model()
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
# Define the log directory
log_dir = os.path.join("logs", "fit", datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
# Create a TensorBoard callback
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)
# Train the model while logging to TensorBoard
model.fit(x=x_train, y=y_train, epochs=5, validation_data=(x_test, y_test), callbacks=[tensorboard_callback])
print(f"TensorBoard logs saved to: {log_dir}")
print("To launch TensorBoard, run: tensorboard --logdir logs/")
tensorboard --version
Debug
Known issues
breakingTensorBoard.dev, the hosted service for sharing TensorBoard experiments, has been shut down as of January 1, 2024. The `tensorboard dev upload` command will no longer function.fixUse TensorBoard as a local tool via the open-source project. For sharing results, consider alternatives like Google Colab's TensorBoard integration or third-party platforms like Weights & Biases.
affects: <=2.15.1
gotchaInstalling both `tensorboard` and `tb-nightly` packages in the same environment can lead to file overwrites and hard-to-debug errors, as they both ship the `tensorboard` Python package.fixAlways install either `tensorboard` (stable) or `tb-nightly` (development) but not both in the same Python environment. If you need the nightly features, stick to `tb-nightly`.
affects: All versions
breakingPython 3.13 removed the built-in `imghdr` module, causing `ModuleNotFoundError` for older TensorBoard versions attempting to import it.fixUpgrade `tb-nightly` to version 2.20.0 or later, which replaces `imghdr` with a `Pillow` dependency for MIME type detection. Alternatively, install `standard-imghdr` if using an older TensorBoard version with Python 3.13.
affects: <2.20.0
gotchaTensorBoard has historically faced compatibility issues with `protobuf` versions, leading to runtime errors. Conflicts can arise if other installed libraries pin `protobuf` to an incompatible version.fixEnsure your `protobuf` installation is compatible with your `tb-nightly` version. Check the official TensorFlow/TensorBoard dependency requirements or update `tb-nightly` to the latest version, which often includes updated `protobuf` constraints. If conflicts persist, consider using a dedicated virtual environment.
affects: All versions (historically and ongoing potential)
gotchaCompatibility issues can arise with `numpy` 2.0. TensorBoard has released updates to ensure compatibility with changes in `numpy` 2.0. [cite: 2.18.0, 2.17.1 release notes]fixUpgrade `tb-nightly` to version 2.18.0 or later to ensure full compatibility with `numpy` 2.0.
affects: <2.18.0
Upgrade
Version history
2.21.0a20251023latest on PyPI · released Oct 23, 2025
Audit
Dependencies
absl-pyrequiredRuntime dependency for utilities
grpciorequiredRPC framework used for communication
markdownrequiredUsed for parsing Markdown content
numpyrequiredNumerical computation library
packagingrequiredCore utilities for Python packaging
pillowrequiredImage processing library, used for MIME type detection in Python 3.13+
protobufrequiredGoogle's data interchange format, critical for data serialization
setuptoolsrequiredPackage discovery and installation
tensorboard-data-serverrequiredBackend for serving TensorBoard data
werkzeugrequiredWSGI utility library for the web server