File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -147,10 +147,17 @@ def flush_figures():
147147def _enable_matplotlib_integration ():
148148 """Enable extra IPython matplotlib integration when we are loaded as the matplotlib backend."""
149149 from matplotlib import get_backend
150- from IPython .core .pylabtools import configure_inline_support
151150 ip = get_ipython ()
152151 backend = get_backend ()
153152 if ip and backend == 'module://%s' % __name__ :
154- configure_inline_support (ip , backend )
153+ from IPython .core .pylabtools import configure_inline_support
154+ try :
155+ configure_inline_support (ip , backend )
156+ except ImportError :
157+ # bugs may cause a circular import on Python 2
158+ def configure_once (* args ):
159+ configure_inline_support (ip , backend )
160+ ip .events .unregister ('post_run_cell' , configure_once )
161+ ip .events .register ('post_run_cell' , configure_once )
155162
156163_enable_matplotlib_integration ()
You can’t perform that action at this time.
0 commit comments