Python: The _imagingft C module is not installed

On Ubuntu, you need to have libfreetype-dev installed before compiling PIL.

i.e.

$ sudo apt-get install libfreetype6-dev
$ sudo -s
\# pip uninstall pil
\# pip install --no-cache-dir pil

PS! Running pip install as sudo will usually install packages to /usr/local/lib on most Ubuntu versions. You may consider to install Pil in a virtual environment (virtualenv or venv) in a path owned by the user instead.

You may also consider installing pillow instead of pil, which I believe is API compatible: https://python-pillow.org. Note that Pillow also requires libfreetype-dev and you might need to follow the same uninstall/install steps if libfreetype-dev was not present during the initial installation.


Your installed PIL was compiled without libfreetype.

You can get precompiled installer of PIL (compiled with libfreetype) here (and many other precompiled Python C Modules):

http://www.lfd.uci.edu/~gohlke/pythonlibs/


The following worked for me on Ubuntu 14.04.1 64 bit:

sudo apt-get install libfreetype6-dev

Then, in the virtualenv:

pip uninstall pillow
pip install --no-cache-dir pillow

solution for CentOS 6 (and probably other rpm based):

yum install freetype-devel libjpeg-devel libpng-devel

pip uninstall pil Pillow
pip install pil Pillow

In OS X, I did this to solve the problem:

pip uninstall PIL
ln -s /usr/X11/include/freetype2 /usr/local/include/
ln -s /usr/X11/include/ft2build.h /usr/local/include/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.dylib
pip install PIL