xk_id xk_id - 3 months ago 17
Python Question

Upgrading matplotlib to 1.5 on OS X 10.11 fails because of freetype

A simple

sudo pip install matplotlib --upgrade


fails with the following log:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.5.0.tar.gz#md5=7952a539418ed77432aa4727409f24cf
Running setup.py egg_info for package matplotlib
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
matplotlib: yes [1.5.0]
python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12
2012, 11:14:05) [GCC 4.0.1 (Apple Inc. build
5493)]]
platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.10.1]
dateutil: yes [using dateutil version 2.4.2]
pytz: yes [using pytz version 2015.7]
cycler: yes [cycler was not found. pip will attempt to
install it after matplotlib.]
tornado: yes [using tornado version 2.2]
pyparsing: yes [Your pyparsing contains a bug that will be
monkey-patched by matplotlib. For best results,
upgrade to pyparsing 2.0.1 or later.]
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.18]
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 [using nose version 1.1.2 / mock is required to
run the matplotlib test suite. "setup.py test" will
automatically download it. Install mock to run
matplotlib.test()]
toolkits_tests: yes [using nose version 1.1.2 / mock is required to
run the matplotlib test suite. "setup.py test" will
automatically download it. Install mock to run
matplotlib.test()]

OPTIONAL BACKEND EXTENSIONS
macosx: yes [installing, darwin]
qt5agg: no [PyQt5 not found]
qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; 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, version 81008]
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: yes [version 9.16]
latex: no
pdftops: no

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

============================================================================
* The following required packages can not be built:
* freetype
Complete output from command python setup.py egg_info:
============================================================================

Edit setup.cfg to change the build options



BUILDING MATPLOTLIB

matplotlib: yes [1.5.0]

python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12

2012, 11:14:05) [GCC 4.0.1 (Apple Inc. build

5493)]]

platform: yes [darwin]



REQUIRED DEPENDENCIES AND EXTENSIONS

numpy: yes [version 1.10.1]

dateutil: yes [using dateutil version 2.4.2]

pytz: yes [using pytz version 2015.7]

cycler: yes [cycler was not found. pip will attempt to

install it after matplotlib.]

tornado: yes [using tornado version 2.2]

pyparsing: yes [Your pyparsing contains a bug that will be

monkey-patched by matplotlib. For best results,

upgrade to pyparsing 2.0.1 or later.]

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.18]

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 [using nose version 1.1.2 / mock is required to

run the matplotlib test suite. "setup.py test" will

automatically download it. Install mock to run

matplotlib.test()]

toolkits_tests: yes [using nose version 1.1.2 / mock is required to

run the matplotlib test suite. "setup.py test" will

automatically download it. Install mock to run

matplotlib.test()]



OPTIONAL BACKEND EXTENSIONS

macosx: yes [installing, darwin]

qt5agg: no [PyQt5 not found]

qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; 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, version 81008]

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: yes [version 9.16]

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 /tmp/pip-build/matplotlib
Storing complete log in /Users/vlad-arisolteanu/.pip/pip.log


Meanwhile,

brew install freetype


returns:

Warning: freetype-2.6_1 already installed


So it looks like freetype is installed on my system. So what is going on? It's disappointing that such a critical Python package as matplotlib isn't installing.

Any help would be appreciated.

Answer

Since you're using Enthought, the recommended way to get stuff like matplotlib installed is to install Canopy Express, which is a free add-on to the Enthought distribution that also gives you access to ~100 packages that can be easily installed into Enthought.

What you're attempting to do with brew and such do not work for Enthought out of the box and would require you to set correct environment variables and build settings, because the system at large is not knowledgeable about brew's existence.

Comments