Skip to content

Commit 05958bc

Browse files
committed
fix set_matplotlib_formats being removed from Ipython
the function has been deprecated from IPython 7.14 and has been removed in IPython 9.0
1 parent a61d45d commit 05958bc

File tree

1 file changed

+8
-1
lines changed
  • src/resources/jupyter/lang/python

1 file changed

+8
-1
lines changed

src/resources/jupyter/lang/python/setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@
2222
plt.rcParams['figure.figsize'] = (fig_width, fig_height)
2323
plt.rcParams['figure.dpi'] = fig_dpi
2424
plt.rcParams['savefig.dpi'] = "figure"
25-
from IPython.display import set_matplotlib_formats
25+
26+
# IPython 7.14 deprecated set_matplotlib_formats from IPython
27+
try:
28+
from matplotlib_inline.backend_inline import set_matplotlib_formats
29+
except ImportError:
30+
# Fall back to deprecated location for older IPython versions
31+
from IPython.display import set_matplotlib_formats
32+
2633
set_matplotlib_formats(fig_format)
2734
except Exception:
2835
pass

0 commit comments

Comments
 (0)