19

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
alekosot
  • 1,105
  • 2
  • 10
  • 19

5 Answers5

28

In Ubuntu 14.04 try:

sudo ln -s /usr/include/freetype2 /usr/local/include/freetype
raacer
  • 203
  • 2
  • 5
mrudult
  • 389
  • 3
  • 4
23

You need the python development headers, and possibly other development packages. Easiest way to get them is:

sudo apt-get build-dep python-imaging
Dennis Kaarsemaker
  • 8,420
  • 3
  • 29
  • 31
3

After installing the development version of Pillow, the second problem was solved as well. It may be related to this issue.

So to sum up, the solution was:

  1. Install dependencies as Dennis said, which in my case also included downgrading the experimental version of libc6 with aptitude remove libc6, which granted the option to DOWNGRADE it to the repo's version.

  2. Installing the Pillow's trunk version with pip install git+git://github.com/python-imaging/Pillow.git

djhaskin987
  • 179
  • 1
  • 7
alekosot
  • 1,105
  • 2
  • 10
  • 19
3

I'm using Debian 7 testing, and for me it worked doing this:

  1. Installing the dependencies as said by Dennis:

    $ sudo apt-get build-dep python-imaging
    
  2. Making a symbolic link as suggested by mrudult:

    $ sudo ln -s -T /usr/include/freetype2/ /usr/include/freetype
    
  3. Install Pillow as usual:

    $ pip install Pillow
    
slm
  • 363,520
  • 117
  • 767
  • 871
Throoze
  • 131
  • 2
1

On a fresh Ubuntu 14.04 install on DigitalOcean, I was able to solve this problem by simply running

sudo apt-get install python-dev

and then re-running the pip install command inside the python venv

pip install Pillow
danske
  • 111
  • 1