Lightning-AI/pytorch-lightning · warning
Starting from v1.9.0, `tensorboardX` has been removed as a d
Error message
Starting from v1.9.0, `tensorboardX` has been removed as a dependency of the `lightning.pytorch` package, due to potential conflicts with other packages in the ML ecosystem. For this reason, `logger=True` will use `CSVLogger` as the default logger, unless the `tensorboard` or `tensorboardX` packages are found. Please `pip install lightning[extra]` or one of them to enable TensorBoard support by default
What it means
Since v1.9.0 tensorboardX is not a dependency of lightning.pytorch. If Trainer(logger=True) (the default) finds neither tensorboard nor tensorboardX installed, it warns and falls back to CSVLogger.
Source
Thrown at src/lightning/pytorch/trainer/connectors/logger_connector/logger_connector.py:76
# `+ 1` because it can be checked before a step is executed, for example, in `on_train_batch_start`
step = loop.epoch_loop._batches_that_stepped + 1
elif isinstance(loop, (pl.loops._EvaluationLoop, pl.loops._PredictionLoop)):
step = loop.batch_progress.current.ready
else:
raise NotImplementedError(loop)
should_log = step % trainer.log_every_n_steps == 0
return should_log or trainer.should_stop
def configure_logger(self, logger: Union[bool, Logger, Iterable[Logger]]) -> None:
if not logger:
# logger is None or logger is False
self.trainer.loggers = []
elif logger is True:
# default logger
if _TENSORBOARD_AVAILABLE or _TENSORBOARDX_AVAILABLE:
logger_ = TensorBoardLogger(save_dir=self.trainer.default_root_dir, version=SLURMEnvironment.job_id())
else:
warning_cache.warn(
"Starting from v1.9.0, `tensorboardX` has been removed as a dependency of the `lightning.pytorch`"
" package, due to potential conflicts with other packages in the ML ecosystem. For this reason,"
" `logger=True` will use `CSVLogger` as the default logger, unless the `tensorboard`"
" or `tensorboardX` packages are found."
" Please `pip install lightning[extra]` or one of them to enable TensorBoard support by default"
)
logger_ = CSVLogger(save_dir=self.trainer.default_root_dir) # type: ignore[assignment]
self.trainer.loggers = [logger_]
elif isinstance(logger, Iterable):
self.trainer.loggers = list(logger)
else:
self.trainer.loggers = [logger]
if (
not any(isinstance(logger, LitLogger) for logger in self.trainer.loggers)
and self.trainer.suggest_integrations
):
rank_zero_info(View on GitHub (pinned to 9fed5c27d2)
Solutions
- pip install lightning[extra] or pip install tensorboard tensorboardX to get TensorBoardLogger by default
- Or explicitly pass logger=TensorBoardLogger(...) / CSVLogger(...) to remove ambiguity
- Point tensorboard at the CSV fallback or use the CSV logs directly
Example fix
# before
trainer = Trainer() # warns, uses CSVLogger
# after
# pip install lightning[extra]
trainer = Trainer(logger=TensorBoardLogger('logs')) Defensive patterns
Strategy: validation
Validate before calling
try:
import tensorboard # noqa
tb = True
except ImportError:
tb = False
logger = TensorBoardLogger('logs') if tb else CSVLogger('logs')
trainer = Trainer(logger=logger) Prevention
- Always pass an explicit logger instead of relying on logger=True
- Install lightning[extra] in images that expect TensorBoard
When it happens
Trigger: Fresh install of lightning without extras; Trainer() with defaults; then checking logs expecting TensorBoard event files.
Common situations: CI environments or slim Docker images without tensorboard; upgrading Lightning and finding logs as CSV instead of tfevents.
Related errors
- Neither `tensorboard` nor `tensorboardX` is available. Try `
- Experiment is not initialized
- `synchronous` requires mlflow>=2.8.0
- NeptuneLogger is no longer supported. Neptune has been sunse
- Providing log_model={log_model} and offline={offline} is an
AI-assisted analysis of Lightning-AI/pytorch-lightning@9fed5c27d2 (2026-08-28).
Data as JSON: /api/errors/150d76109d9f495a.
Report an issue: GitHub.