0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

matplotlibでset_matplotlib_formatsがimportできない

Last updated at Posted at 2025-04-07

経緯

大学の授業で「Pythonではじめる機械学習;scikit-learnで学ぶ特徴量エンジニアリングと機械学習の基礎」を使うので環境構築してたらこんなエラーが出た

ImportError: cannot import name 'set_matplotlib_formats' from 'IPython.display'

set_matplotlib_formatsが見つからないとのこと
たしかにIPython.displayにはなかった

環境

関係ありそうなのはこの辺り

ipython==9.0.2
matplotlib==3.10.1
matplotlib-inline==0.1.7

原因

どうやらset_matplotlib_formatsの場所が移動したらしい
importの部分をこのように変更すると解決できる

from matplotlib_inline.backend_inline import set_matplotlib_formats
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?