Skip to content

tensorboard() fails with newer tensorboard versions #626

@dfalbel

Description

@dfalbel

Description

tensorflow::tensorboard() fails with recent versions of TensorBoard because the internal tensorboard_version() function calls system("tensorboard --version_tb", intern = TRUE), which returns character(0) with newer TensorBoard versions (the --version_tb flag no longer exists).

This causes package_version(character(0)) to error with "argument is of length zero".

Traceback

Error in `.f()`:
! argument is of length zero
Backtrace:
    ▆
 1. └─tensorflow::tensorboard(temp, port = 6060)
 2.   └─tensorflow:::launch_tensorboard(...)

Root cause

In launch_tensorboard(), the function calls tensorboard_version() to decide how to format the --logdir argument. tensorboard_version() is:

function () {
    if (is.null(ver <- .globals$tensorboard_version)) {
        ver <- package_version(system("tensorboard --version_tb", 
            intern = TRUE, ignore.stderr = TRUE))
        .globals$tensorboard_version <- ver
    }
    ver
}

The --version_tb flag is no longer recognized by newer TensorBoard, so system() returns character(0), and package_version(character(0)) errors.

Suggested fix

Use tensorboard --version instead of --version_tb, or handle the case where the command returns an empty result.

Environment

  • TensorBoard installed via pip install tensorboard (version bundled with TensorFlow 2.18+)
  • Observed on Ubuntu (GitHub Actions) and macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions