LoginSignup
31
30

More than 5 years have passed since last update.

matplotlibのインストールでつまづいた話

Posted at

CentOS6.5でデータ解析の環境を整えようとしたとき、matplotlibのインストールでつまづきました。

まずは、普通にpipでインストール

$ pip install matplotlib
Downloading/unpacking matplotlib
  Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
  Running setup.py (path:/tmp/pip_build_vagrant/matplotlib/setup.py) egg_info for package matplotlib
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.4.0]
                    python: yes [2.7.7 (default, Aug 25 2014, 16:44:54)  [GCC
                            4.4.7 20120313 (Red Hat 4.4.7-4)]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.8.2]
                       six: yes [using six version 1.7.3]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [using tornado version 4.0.1]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [Requires freetype2 2.4 or later.  Found
                            2.3.11.]
                       png: yes [version 1.2.49]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]


...


============================================================================

                        * The following required packages can not be built:

                        * freetype

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_vagrant/matplotlib
Storing debug log for failure in /home/vagrant/.pip/pip.log

freetypeというものがないらしいので、インストールします。

$ sudo yum install freetype

改めて、matplotlibをインストールすると・・

$ pip install matplotlib
Downloading/unpacking matplotlib

...

    * The following required packages can not be built:
    * freetype

同じエラーが発生。
もう一度、エラーメッセージを読みなおしてみると、

freetype: no  [Requires freetype2 2.4 or later.  Foundd 2.3.11.]

どうやら、バージョン2.4以上必要なのに、2.3.11が入ってるとのこと。(長いエラーメッセージの途中じゃなくて、色を変えるとか、一番下に表示するとか、もっと強調して欲しかった。。)

そして、yumでは、2.4以上のものはインストールできないみたいなので、こちらから最新版をダウンロードして、ソースからコンパルしてました。現時点(2014.8.29)の最新版は、2.5.3でした。

$ tar xzvf freetype-2.5.3.tar.gz2
$ cd freetype-2.5.3
$ ./configure
$ make
$ make install

make installでエラーでました。
ここでも大いにつまづきました。。

調べたところ、gmakeを使うと解決するらしい。

$ cd freetype-2.5.3
$ env GNUMAKE="/usr/local/bin/gmake"
$ ./builds/unix/configure
$ gmake
$ gmake install

これでようやくインストールできました。
再び、pipでインストールして、無事インストール完了。

1つモジュール入れるだけなのに、半日くらいかかりました。。

参考

31
30
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
31
30