[PYTHON] Install matplotlib on OS X El Capitan

A note on putting matplotlib in El Capitan with pip. It's a punch line that pkg-config and freetype are not included, so there is not much content.


First of all, hit the command casually. But I get an error.

$ pip install matplotlib
Collecting matplotlib
  Using cached matplotlib-1.5.3.tar.gz
    Complete output from command python setup.py egg_info:
    IMPORTANT WARNING:
        pkg-config is not installed.
        matplotlib may not be able to find some of its dependencies
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.3]
                    python: yes [3.6.0 (v3.6.0:41df79263a11, Dec 22 2016,
                            17:23:13)  [GCC 4.2.1 (Apple Inc. build 5666) (dot
                            3)]]
                  platform: yes [darwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.11.3]
                  dateutil: yes [dateutil was not found. It is required for date
                            axis support. pip/easy_install may attempt to
                            install it after matplotlib.]
                      pytz: yes [pytz was not found. pip will attempt to install
                            it after matplotlib.]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [using tornado version 4.4.2]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: yes [version 1.6.26]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]
            toolkits_tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / using
                            unittest.mock]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: yes [installing, darwin]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: no  [PySide not found; PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

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

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8p/6g32nfj53nn59v0py80lzjgx2rswc_/T/pip-build-0vtpc0zd/matplotlib/

Since it is said as below, I decided to put both in homebrew.

pkg-config is not installed
freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]

First, install what you need with the brew command, then

$ brew install pkg-config freetype

Install matplotlib again.

$ pip install matplotlib

This time it worked.

Recommended Posts

Install matplotlib on OS X El Capitan
Installing TensorFlow 0.11.0rc2 on OS X El Capitan (10.11.6)
Install Sphinx on Mac OS X
Install python3 on Mac (El Capitan)
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Steps to install the latest version of OpenCV on OS X El Capitan without Homebrew
Build an environment with pyenv, pyenv-virtualenv, jupyter on OS X El Capitan
Install NumPy, SciPy, Matplotlib with Homebrew on OS X (as of November 2015)
Install tomcat 9 on Cent OS 8
Very easy to install SciPy on Mac OS X
How to install caffe on OS X with macports
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
Memo on Mac OS X
R environment construction with Jupyter (formerly IPython notebook) (on OS X El Capitan 10.11.3)
When import tkinter is not possible on Mac OS X 10.11.3 (El Capitan) + pyenv + Python 3.5.1.
Install openssl-1.0.2l on OSX El Capitan and update Python's _ssl.so
Build a python environment with pyenv (OS X El Capitan 10.11.3)
How to install Theano on Mac OS X with homebrew
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Install Adopt OpenJDK 11 on Cent OS 8
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Steps to install matplotlib on Mac
Install Scipy on Mac OS Sierra
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
I installed Caffe so that I can do deep learning on MAC OS X El Capitan
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Install lp_solve on Mac OS X and call it with python.
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
Installed aws-cli On Mac OS X Lion
Install 64-bit OS (bate) on Raspberry Pi
Install docker-compose on 64-bit Raspberry Pi OS
GeoDjango + SQLite environment construction on OS X
Run NASA CEA on Mac OS X
Install Python3, numpy, pandas, matplotlib, etc. on Windows
[Note] Install wxPython 3.x on Linux Mint (Ubuntu)
Run Zookeeper x python (kazoo) on Mac OS X
Install shogun with python modular (OS X Yosemite)
Shpinx (Python documentation builder) on Mac OS X
Run Qiita API v2 Python wrapper in Python3 environment (Mac OS X 10.11 (El Capitan))
Install LightGBM in an OS X virtualenv environment
Preparing to use aws cli on Mac OS X
Building an environment for "Tello_Video" on Mac OS X
Try using E-Cell 4 on Windows 7 or Mac OS X
Build a Python development environment on Mac OS X
Instructions for installing CUDA 7.5 on Mac (El Capitan) + Homebrew
Install and develop Git, VSCode, Docker on Chrome OS
mac OS X 10.15.x pyenv Python If you can't install
OS X EI Capitan (10.11.6) AWS CLI installation error (python-dateutil)
Create a Python development environment on OS X Lion
Install Tensorflow on Mac
Install TensorFlow on Ubuntu
Install python on WSL
Install Faiss on CentOS 7
Install pyenv on mac
Install pip on Mavericks
Install Python on Pidora.
Install mongodb on termux
I learned MNIST with Caffe and tried to draw it (MAC OS X El Capitan)