Install & Compatibility
Where this runs
tested against v2.5.3 · 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.920 runs
installs and imports cleanly · install 0.0s · import 0.818s · 343.6MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 15.9s · import 0.545s · 333MB
351MB installed
● package 351MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LogWriter
✓ from visualdl import LogWriter
The primary class for writing log data to be visualized.
This quickstart code demonstrates how to initialize a `LogWriter` and record scalar data over multiple steps for both 'train' and 'eval' modes. After running this script, launch the VisualDL board from your terminal using the provided command to view the generated visualizations.
import random
from visualdl import LogWriter
import os
# Create a log directory
logdir = os.path.join(os.environ.get('VISUALDL_LOGDIR', './visualdl_logs'))
os.makedirs(logdir, exist_ok=True)
# Initialize LogWriter
# The sync_cycle parameter specifies how often data should be written to disk.
logger = LogWriter(logdir=logdir, sync_cycle=1000)
# Log scalar data
with logger.mode("train"):
scalar_writer = logger.scalar("scalars/loss")
for step in range(100):
scalar_writer.add_record(step, random.random() * 10)
with logger.mode("eval"):
scalar_writer = logger.scalar("scalars/accuracy")
for step in range(100):
scalar_writer.add_record(step, random.random())
print(f"VisualDL logs saved to: {logdir}")
print(f"To view, run in your terminal: visualdl --logdir {logdir}")
visualdl --version
Debug
Known issues
gotchaRunning VisualDL might result in `TypeError: __init__() got an unexpected keyword argument 'file'` if your `protobuf` library version is too old (not 3.5+).fix`pip install --upgrade protobuf`
affects: All versions of VisualDL when used with `protobuf < 3.5`.
breakingIn VisualDL v2.1.0 and later, the `LogReader` class changed a parameter name from `file_name` to `file_path`. Older code using `file_name` will break.fixUpdate `LogReader(file_name=...)` to `LogReader(file_path=...)`.
affects: v2.1.0 and later
deprecatedVisualDL officially dropped support for Python 2 on January 1, 2020. While older versions might technically work, Python 3 is now required for full functionality, new features, and continued updates.fixEnsure your development environment uses Python 3.x.
affects: v2.0.0 and later
Upgrade
Version history
2.5.3latest on PyPI · released Jun 5, 2023
Audit
Dependencies
protobufrequiredRequired for logging, older versions can cause runtime errors.