Debian – Install PIL/Pillow via pip in Debian testing (Jessie)

debianpippython

On Debian testing (Jessie), when I try to install PIL or Pillow (python imaging libs) in a virtualenv via pip I get the following error:

running egg_info
writing Pillow.egg-info/PKG-INFO
writing top-level names to Pillow.egg-info/top_level.txt
writing dependency_links to Pillow.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'Pillow.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'Pillow.egg-info/SOURCES.txt'
running build_ext
building 'PIL._imaging' extension
creating build/temp.linux-x86_64-2.7/libImaging
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -IlibImaging -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c _imaging.c -o build/temp.linux-x86_64-2.7/_imaging.o
_imaging.c:76:20: fatal error: Python.h: No such file or directory
 #include "Python.h"
                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have installed all dependencies for Pillow, based on my experience with Wheezy, but it seems something is different with testing.

Any suggestions?

EDIT

In fact I discovered another problem with libc6. The version I had was from experimental. After downgrading it to testing's version, I reinstalled all dependencies but now I get a different error:

building 'PIL._imagingft' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/usr/include/tcl8.5 -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c _imagingft.c -o build/temp.linux-x86_64-2.7/_imagingft.o
_imagingft.c:62:31: fatal error: freetype/fterrors.h: No such file or directory
 #include <freetype/fterrors.h>
                               ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

It seems the experimental version of libc6 messed things up, but I can't figure out what's wrong. Aptitude doesn't show any unmet dependencies and aptitude install -f does nothing.

Also, if indeed the linux-headers are relevant, the ones I have installed are:

  • linux-headers-3.11-2-all
  • linux-headers-3.11-2-all-amd64
  • linux-headers-3.11-2-amd64
  • linux-headers-3.11-2-common
  • linux-headers-3.2.0-4-amd64
  • linux-headers-3.2.0-4-common
  • linux-headers-amd64

Best Answer

In Ubuntu 14.04 try:

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