From edb97f52baf69a857983ea2709f4d443e0f6cf0c Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Fri, 8 May 2026 11:21:18 -0400 Subject: [PATCH 1/3] Fix `tensorboard()` launch closes #626 --- R/tensorboard.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tensorboard.R b/R/tensorboard.R index 2b7c1fd..15f7f6c 100644 --- a/R/tensorboard.R +++ b/R/tensorboard.R @@ -142,7 +142,7 @@ tensorboard <- function(log_dir, action = c("start", "stop"), tensorboard_version <- function() { if (is.null(ver <- .globals$tensorboard_version)) { - ver <- package_version(system("tensorboard --version_tb", intern = TRUE, ignore.stderr = TRUE)) + ver <- package_version(system("tensorboard --version", intern = TRUE, ignore.stderr = TRUE)) .globals$tensorboard_version <- ver } ver From 59256f0ed971eacf0d248e1b8a51ad561d0deb9b Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Fri, 8 May 2026 11:21:54 -0400 Subject: [PATCH 2/3] Fix warnings from `tensorboard` --- .Rbuildignore | 3 +++ .gitignore | 1 + R/tensorboard.R | 27 ++++++++++++++------------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 0ba9269..e3541c3 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -20,3 +20,6 @@ MNIST-data ^cran-comments\.md$ ^CRAN-SUBMISSION$ ^revdep$ +^\.positai$ +^\.claude$ +^\.codex$ diff --git a/.gitignore b/.gitignore index f79c931..9cd0d9b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ MNIST-data issues/ logs revdep +.positai diff --git a/R/tensorboard.R b/R/tensorboard.R index 15f7f6c..74fcc47 100644 --- a/R/tensorboard.R +++ b/R/tensorboard.R @@ -149,6 +149,17 @@ tensorboard_version <- function() { } +tensorboard_python_warnings <- function() { + filter <- "ignore:pkg_resources is deprecated as an API:UserWarning:tensorboard.default" + warnings <- Sys.getenv("PYTHONWARNINGS", unset = "") + + if (nzchar(warnings)) + paste(warnings, filter, sep = ",") + else + filter +} + + launch_tensorboard <- function(log_dir, host, port, explicit_port, reload_interval, purge_orphaned_data) { if (tensorboard_version() < "2.0") { @@ -172,7 +183,8 @@ launch_tensorboard <- function(log_dir, host, port, explicit_port, reload_interv "--port", as.character(port), "--reload_interval", as.integer(reload_interval), "--purge_orphaned_data", purge_orphaned_data), - stdout = "|", stderr = "|") + stdout = "|", stderr = "|", + env = c("current", PYTHONWARNINGS = tensorboard_python_warnings())) # poll for availability of the http server (continue as long as the # process is still alive). note that we used to poll for stdout however @@ -202,21 +214,10 @@ launch_tensorboard <- function(log_dir, host, port, explicit_port, reload_interv err <- p$read_error_lines() # write it unless it's a port in use error when we are auto-binding - if (explicit_port || !any(grepl(paste0("^.*", port, ".*already in use.*$"), err))) + if (length(err) && (explicit_port || !any(grepl(paste0("^.*", port, ".*already in use.*$"), err)))) write(err, stderr()) } # return the process p } - - - - - - - - - - - From e6a88e5070ca6dffd60564a8905be941c34fb3e6 Mon Sep 17 00:00:00 2001 From: Tomasz Kalinowski Date: Fri, 8 May 2026 11:45:35 -0400 Subject: [PATCH 3/3] Add NEWS entries --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 29e4225..e87a74f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # tensorflow (development version) +- Updated docs to recommend `py_require_tensorflow()` for TensorFlow setup (#627). +- Fixed `tensorboard()` startup with recent TensorBoard versions (#626). + # tensorflow 2.20.0 - Updates for reticulate 1.41 and `reticuate::py_require()`.