[PYTHON] A story that stumbled upon installing matplotlib

When I tried to prepare the data analysis environment with CentOS6.5, I stumbled upon installing matplotlib.

First, install with pip normally

$ 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

It seems that there is no freetype, so install it.

$ sudo yum install freetype

If you install matplotlib again ...

$ pip install matplotlib
Downloading/unpacking matplotlib

...

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

The same error occurred. When I read the error message again,

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

Apparently, version 2.4 or higher is required, but 2.3.11 is included. (I wanted you to emphasize more, such as changing the color or displaying it at the bottom, not in the middle of a long error message.)

And it seems that yum can't install anything above 2.4, so here I downloaded the latest version from / releases / freetype /) and compiled it from the source. The latest version at this time (August 29, 2014) was 2.5.3.

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

There was an error in make install. I stumbled a lot here as well. ..

After investigating, it seems that using gmake will solve the problem.

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

You have finally installed it. Install with pip again and the installation is completed successfully.

It took about half a day to put in one module. ..

reference

Recommended Posts

A story that stumbled upon installing matplotlib
A story that stumbled upon a comparison operation
A story that stumbled when I made a chatbot with Transformer
A story that stumbled when using pip in a proxy environment
A story about installing matplotlib using pip with an error
I stumbled upon installing sentencepiece on ubuntu
A memo that I stumbled upon when doing a quote RT on Twitter Bot
A story that Seaborn was easy, convenient and impressed
A story that reduces the effort of operation / maintenance
Story that an inexperienced person made a masked solver
A story that struggled with the common set HTTP_PROXY = ~
I stumbled upon using MoviePy, so make a note
A story that I was addicted to at np.where
A story that analyzed the delivery of Nico Nama.
A story that stopped my heart after upgrading OpenStack
A story that was terrible if SELinux was properly disabled
A story about stumbling through PATH after installing anaconda
A memorandum about matplotlib
Stumbled when installing PyOCR
matplotlib this and that
A story that took time to understand python's argsort (memorial)
An error that stumbled upon learning YOLO on Google Colab
[Python] A story that seemed to fall into a rounding trap
A story that I had a hard time displaying graphs on top of each other with matplotlib