From 82c8805d74ca206b36793ce1861933251458136b Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Thu, 20 Mar 2025 16:19:50 -0500 Subject: [PATCH 1/2] Add handling for if jupyterlab / notebook isn't defined --- plotly/io/_renderers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plotly/io/_renderers.py b/plotly/io/_renderers.py index 55e1ab94cd..db9a8d5902 100644 --- a/plotly/io/_renderers.py +++ b/plotly/io/_renderers.py @@ -50,14 +50,14 @@ def display_jupyter_version_warnings(): return elif "jupyter-notebook" in parent_process: jupyter_notebook = optional_imports.get_module("notebook") - if jupyter_notebook.__version__ < "7": + if jupyter_notebook is not None jupyter_notebook.__version__ < "7": # Add warning about upgrading notebook warnings.warn( f"Plotly version >= 6 requires Jupyter Notebook >= 7 but you have {jupyter_notebook.__version__} installed.\n To upgrade Jupyter Notebook, please run `pip install notebook --upgrade`." ) elif "jupyter-lab" in parent_process: jupyter_lab = optional_imports.get_module("jupyterlab") - if jupyter_lab.__version__ < "3": + if jupyter_lab is not None and jupyter_lab.__version__ < "3": # Add warning about upgrading jupyterlab warnings.warn( f"Plotly version >= 6 requires JupyterLab >= 3 but you have {jupyter_lab.__version__} installed. To upgrade JupyterLab, please run `pip install jupyterlab --upgrade`." From 856331c18a3edb64f6850d6dd032155ba74598a1 Mon Sep 17 00:00:00 2001 From: Martha Cryan Date: Fri, 21 Mar 2025 14:32:39 -0500 Subject: [PATCH 2/2] Fix syntax error --- plotly/io/_renderers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/io/_renderers.py b/plotly/io/_renderers.py index db9a8d5902..2e1c5c64c5 100644 --- a/plotly/io/_renderers.py +++ b/plotly/io/_renderers.py @@ -50,7 +50,7 @@ def display_jupyter_version_warnings(): return elif "jupyter-notebook" in parent_process: jupyter_notebook = optional_imports.get_module("notebook") - if jupyter_notebook is not None jupyter_notebook.__version__ < "7": + if jupyter_notebook is not None and jupyter_notebook.__version__ < "7": # Add warning about upgrading notebook warnings.warn( f"Plotly version >= 6 requires Jupyter Notebook >= 7 but you have {jupyter_notebook.__version__} installed.\n To upgrade Jupyter Notebook, please run `pip install notebook --upgrade`."