From 8af1cc1ba1dc3d75e2eaa2a64b4caad3bd6efb36 Mon Sep 17 00:00:00 2001 From: Antoni Baum Date: Thu, 12 May 2022 13:27:35 +0200 Subject: [PATCH] [Tune] Fix Jupyter reporter with older IPython (#24695) Fixes `JupyterNotebookReporter` not working with older IPython versions (eg. 5.5.0, installed on Google Colab). --- python/ray/tune/progress_reporter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/ray/tune/progress_reporter.py b/python/ray/tune/progress_reporter.py index ce2415896..6e05b4a1b 100644 --- a/python/ray/tune/progress_reporter.py +++ b/python/ray/tune/progress_reporter.py @@ -546,12 +546,12 @@ class JupyterNotebookReporter(TuneReporterBase, RemoteReporterMixin): self.display(progress_str) def display(self, string: str) -> None: - from IPython.core.display import display, HTML + from IPython.display import display, HTML, clear_output if not self._display_handle: - self._display_handle = display( - HTML(string), display_id=True, clear=self._overwrite - ) + if self._overwrite: + clear_output(wait=True) + self._display_handle = display(HTML(string), display_id=True) else: self._display_handle.update(HTML(string))