Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing Python Image Library using pip on Mac OS X 10.9

Tags:

python

macos

pip

I want to install PIL on Mavericks using pip but get this error.

_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found
#include <freetype/fterrors.h>
         ^
1 error generated.
error: command 'cc' failed with exit status 1

My Command Line Tools are installed and up to date and every hint I found didn't help. How can I get this to compile?

EDIT: I just checked, freetype is also already installed via homebrew

like image 450
Lukas Spieß Avatar asked Dec 02 '13 10:12

Lukas Spieß


4 Answers

Instead of symlinking to a specific version of freetype2, do this:

ln -s /usr/local/include/freetype2 /usr/local/include/freetype

This saves you the trouble of recreating the symlink whenever you upgrade freetype2.

like image 58
mcuelenaere Avatar answered Oct 24 '22 06:10

mcuelenaere


With macports, the solution that worked for me:

sudo port install freetype
sudo ln -s /opt/local/include/freetype2 /opt/local/include/freetype

And then re-run the PIL build process.

like image 31
Mike Fogel Avatar answered Oct 24 '22 06:10

Mike Fogel


I've solved this problem with this symlink:

ln -s /usr/local/Cellar/freetype/2.5.1/include/freetype2 /usr/local/include/freetype

I have freetype already installed via homebrew too.

like image 28
Dmitry Akinin Avatar answered Oct 24 '22 07:10

Dmitry Akinin


This is caused by a change in the headers of freetype >= 2.1.5. PIL is not using the correct documented way to include the freetype headers, which causes the build to fail now that freetype finally removed the long-deprecated way of including the headers. This problem is documented right at the top of http://freetype.sourceforge.net/freetype2/docs/tutorial/step1.html:

NOTE: Starting with FreeType 2.1.6, the old header file inclusion scheme is no longer supported. This means that you now get an error if you do something like the following:

#include <freetype/freetype.h>
#include <freetype/ftglyph.h>

Please take this problem upstream to the developers of PIL and advise them to use the documented way of including freetype headers:

#include <ft2build.h>
#include FT_ERRORS_H

like image 5
neverpanic Avatar answered Oct 24 '22 07:10

neverpanic