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
Description
tensorflow::tensorboard()fails with recent versions of TensorBoard because the internaltensorboard_version()function callssystem("tensorboard --version_tb", intern = TRUE), which returnscharacter(0)with newer TensorBoard versions (the--version_tbflag no longer exists).This causes
package_version(character(0))to error with "argument is of length zero".Traceback
Root cause
In
launch_tensorboard(), the function callstensorboard_version()to decide how to format the--logdirargument.tensorboard_version()is:The
--version_tbflag is no longer recognized by newer TensorBoard, sosystem()returnscharacter(0), andpackage_version(character(0))errors.Suggested fix
Use
tensorboard --versioninstead of--version_tb, or handle the case where the command returns an empty result.Environment
pip install tensorboard(version bundled with TensorFlow 2.18+)