Pillow: Python.h not found when installing on Ubuntu / virtualenv / pypy

Created on 25 Mar 2013  Â·  4Comments  Â·  Source: python-pillow/Pillow

Everything is good with Python 2.7.3.
I'm just trying with pypy, and unfortunately, it doesn't find Python.h
It fails with:

$ pip install Pillow
running build_ext
building '_imaging' extension
cc -fPIC -Wimplicit -DHAVE_LIBZ -IlibImaging -I/usr/local/include -I/usr/include -I/home/ubuntu/Code/mfi/intmanager/integration-manager/branches/SIS_INDO.gitsvn/ve.pypy/include -I/usr/include/i386-linux-gnu -c _imaging.c -o build/temp.linux-i686-2.7/_imaging.o
_imaging.c:75:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'cc' failed with exit status 1

Python.h is there

$ locate Python.h
/usr/include/python2.7/Python.h

And if I add into setup.py (line 94) the hard-coded path, it's working:

         _add_directory(include_dirs, "libImaging")
+        _add_directory(include_dirs, "/usr/include/python2.7")

Versions:

$ pypy
Python 2.7.2 (1.9+dfsg-1, Jun 19 2012, 23:23:45)
[PyPy 1.9.0 with GCC 4.7.0] on linux2
$ cat /etc/issue
Ubuntu 12.10

Hope it helps.

Installation

Most helpful comment

I struggled with this today and it finally dawned on me to install the pypy-dev package alongside pypy. PIL built with no problems after that.

All 4 comments

I'm not sure I understand how PyPy is supposed to work here. Shouldn't it have it's own set of include dirs? Also, I'd expect "/usr/include" to be enough for PIL to find the appropriate includes… CC: @fijal

I struggled with this today and it finally dawned on me to install the pypy-dev package alongside pypy. PIL built with no problems after that.

Great!

I had this issue because of an upgrade to Ubuntu. Just rebuilding the virtualenv (now 2.7 after OS upgrade) fixed it for me.

Was this page helpful?
0 / 5 - 0 ratings