From 44e25c7ed3ecdbd62dfd5798397051e11c83b24a 2024-04-13 20:22:41 From: Ian Thomas Date: 2024-04-13 20:22:41 Subject: [PATCH] Fix use of --pylab=auto and --matplotlib=auto --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index b155744..e9e6493 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -3654,6 +3654,13 @@ class InteractiveShell(SingletonConfigurable): make sense in all contexts, for example a terminal ipython can't display figures inline. """ + from .pylabtools import _matplotlib_manages_backends + + if not _matplotlib_manages_backends() and gui in (None, "auto"): + # Early import of backend_inline required for its side effect of + # calling _enable_matplotlib_integration() + import matplotlib_inline.backend_inline + from IPython.core import pylabtools as pt gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select)