matplotlib を、matplotlib (1.3.1) から、matplotlib (2.0.2) に upgrade した際に、発生した問題とその解決方法を記載します。
前提
OS 、 python の version 情報は以下になります。
-
OS
% sw_vers ProductName: Mac OS X ProductVersion: 10.12.6 BuildVersion: 16G29
-
python
% python -V Python 2.7.10
何故 upgrade しようと思ったか
matplotlib.pyplot.show() で、FutureWarning が発生しておりました。
いい加減毎回出力されるのがうざいので、upgrade を実施しました。
出力 Warning は以下の内容でした。
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/collections.py:608: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors_original != 'face':
pip で upgrade を実施する
とりあえず、upgrade すれば消えるだろうと、
% sudo pip install -U matplotlib
Found existing installation: pyparsing 2.0.1
DEPRECATION: Uninstalling a distutils installed project (pyparsing) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyparsing-2.0.1:
% sudo pip list | grep matplotlib
matplotlib (1.3.1)
six
を install 対象外にして、再度 pip を実行しました。sudo pip install matplotlib --upgrade --ignore-installed six
matplotlib (2.0.2)
になりました。% pip list | grep matplotlib
matplotlib (2.0.2)
Error 自体は何か見たことあると思ったんですが、
pandas を upgrade して 同じエラーに同じくsix
を install 対象外にして対処していました。。
mac os sierra の pandas を upgrade したら [Errno 1] Operation not permitted:
が発生 | Monotalk
Font cache を削除する
upgrade 後にスクリプトを実行すると以下のWarning が出力されました。
/Library/Python/2.7/site-packages/matplotlib/font_manager.py:280: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
'Matplotlib is building the font cache using fc-list. '
Font が 見つからず、デフォルトのFont が使われる
グラフ描画時に使用しているFont が見つからないというWarning が出力されるようになりました。
これは、指定していたFontがそもそも元々見つかっておらず、Upgrade によりメッセージが出力されるようになった、
もしくは、Font cache には存在していたが消したので見つからないのいずれかかと思います。
/Library/Python/2.7/site-packages/matplotlib/font_manager.py:1297: UserWarning: findfont: Font family [u'Yu Gothic'] not found. Falling back to DejaVu Sans
(prop.get_family(), self.defaultFamily[fontext]))
Error で落ちないまでも、警告はいろいろでますね。
以上です。
コメント