{"id":4797,"library":"tb-nightly","title":"TensorBoard Nightly","description":"tb-nightly is the nightly build for TensorBoard, a suite of web applications that provides visualization and tooling for machine learning experimentation. It allows users to track and visualize metrics like loss and accuracy, view model graphs, project embeddings, and display various data types. This version tracks the latest development of TensorFlow, offering bleeding-edge features and bug fixes. It follows an active release cadence, typically updating daily with the latest changes from the main development branch.","status":"active","version":"2.21.0a20251023","language":"en","source_language":"en","source_url":"https://github.com/tensorflow/tensorboard","tags":["tensorflow","machine learning","visualization","monitoring","deep learning","nightly"],"install":[{"cmd":"pip install tb-nightly","lang":"bash","label":"Install tb-nightly"}],"dependencies":[{"reason":"Runtime dependency for utilities","package":"absl-py","optional":false},{"reason":"RPC framework used for communication","package":"grpcio","optional":false},{"reason":"Used for parsing Markdown content","package":"markdown","optional":false},{"reason":"Numerical computation library","package":"numpy","optional":false},{"reason":"Core utilities for Python packaging","package":"packaging","optional":false},{"reason":"Image processing library, used for MIME type detection in Python 3.13+","package":"pillow","optional":false},{"reason":"Google's data interchange format, critical for data serialization","package":"protobuf","optional":false},{"reason":"Package discovery and installation","package":"setuptools","optional":false},{"reason":"Backend for serving TensorBoard data","package":"tensorboard-data-server","optional":false},{"reason":"WSGI utility library for the web server","package":"werkzeug","optional":false}],"imports":[{"note":"Commonly used for logging from PyTorch or general Python scripts.","symbol":"SummaryWriter","correct":"from torch.utils.tensorboard import SummaryWriter"},{"note":"Used as a callback in TensorFlow/Keras training for automatic logging.","symbol":"TensorBoard (Keras Callback)","correct":"from tensorflow.keras.callbacks import TensorBoard"},{"note":"Direct API for logging various data types in TensorFlow.","symbol":"tf.summary","correct":"import tensorflow as tf; tf.summary"},{"note":"While 'tensorboard.program' is the core entry point for launching, users typically invoke TensorBoard via the command line or `%tensorboard` magic in notebooks. Direct programmatic use is for advanced integrations.","wrong":"tb = program.TensorBoard() # Direct instantiation is less common for end-users","symbol":"Program","correct":"from tensorboard import program"}],"quickstart":{"code":"import datetime\nimport os\n\nimport tensorflow as tf\n\n# Create a simple Keras model.\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\ndef create_model():\n    return tf.keras.models.Sequential([\n        tf.keras.layers.Flatten(input_shape=(28, 28)),\n        tf.keras.layers.Dense(512, activation='relu'),\n        tf.keras.layers.Dropout(0.2),\n        tf.keras.layers.Dense(10, activation='softmax')\n    ])\n\nmodel = create_model()\nmodel.compile(optimizer='adam',\n              loss='sparse_categorical_crossentropy',\n              metrics=['accuracy'])\n\n# Define the log directory\nlog_dir = os.path.join(\"logs\", \"fit\", datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\"))\n\n# Create a TensorBoard callback\ntensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)\n\n# Train the model while logging to TensorBoard\nmodel.fit(x=x_train, y=y_train, epochs=5, validation_data=(x_test, y_test), callbacks=[tensorboard_callback])\n\nprint(f\"TensorBoard logs saved to: {log_dir}\")\nprint(\"To launch TensorBoard, run: tensorboard --logdir logs/\")","lang":"python","description":"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."},"warnings":[{"fix":"Use 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.","message":"TensorBoard.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.","severity":"breaking","affected_versions":"<=2.15.1"},{"fix":"Always 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`.","message":"Installing 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade `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.","message":"Python 3.13 removed the built-in `imghdr` module, causing `ModuleNotFoundError` for older TensorBoard versions attempting to import it.","severity":"breaking","affected_versions":"<2.20.0"},{"fix":"Ensure 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.","message":"TensorBoard 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.","severity":"gotcha","affected_versions":"All versions (historically and ongoing potential)"},{"fix":"Upgrade `tb-nightly` to version 2.18.0 or later to ensure full compatibility with `numpy` 2.0.","message":"Compatibility 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]","severity":"gotcha","affected_versions":"<2.18.0"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}