old school magic

機械学習に関する備忘録です。

OS X Mavericksにアップデートしたらhomebrewでインストールしたscipyがアップデートできなくなった話

問題

前までhomebrewを使ってpython2/numpy/scipyをインストールしていたのですが、Mavericksにしてからscipyのアップデートができなくなりました。

Error: scipy dependency tbb was built with the following
C++ standard library: libc++ (from clang)

This is incompatible with the standard library being used
to build scipy: libstdc++ (from clang)

Please reinstall tbb using a compatible compiler.
hint: Check https://github.com/mxcl/homebrew/wiki/C++-Standard-Libraries

scipyが依存しているtbbというパッケージのエラーです。
MavericksになってからC++コンパイラが変わったらしく、tbbを再インストールし直せとのことですが直らず...

調べてみたら同じ問題に直面した方もいらっしゃったみたいです。
Unable to brew scipy on os x mavericks · Issue #48 · samueljohn/homebrew-python · GitHub

直らないので

いっそのこと全部インストールし直そう!と思いhomebrewごと再インストールしたのですが、いつのまにかnumpy/scipyがbrewのパッケージから無くなってました...
というわけで、pythonだけbrewで、他はpipでインストールしたらうまく行きました。

# pythonはbrewでインストール
brew install python

# 科学技術計算環境はpipでインストール
pip install numpy
pip install scipy
pip install matplotlib
pip install scikit-learn

pipで入れられるものは極力pipで入れたほうがいいのかもしれません。