[Image-SIG] Installing without root

Fredrik Lundh fredrik at pythonware.com
Wed Jul 26 22:49:38 CEST 2006

Tyson Tate wrote:

> I'm trying to install PIL 1.1.5 on my shared hosting server  
> (Bluehost) for use with Django (a Python web application framework).
> I ran setup.py with a custom prefix and it ran smoothly until it died  
> on some Tk dependencies:
> ---
> # python setup.py install --prefix=~/python_libs
> [snip]
> ude -I/usr/include/python2.3 -c _imagingft.c -o build/temp.linux- 
> i686-2.3/_imagingft.o
> gcc -pthread -shared build/temp.linux-i686-2.3/_imagingft.o -L/usr/ 
> lib -lfreetype -o build/lib.linux-i686-2.3/_imagingft.so
> building '_imagingtk' extension
> creating build/temp.linux-i686-2.3/Tk
> gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -m32 - 
> march=i386 -mtune=pentium4 -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/ 
> freetype2 -IlibImaging -I/usr/include -I/usr/include/python2.3 -c Tk/ 
> tkImaging.c -o build/temp.linux-i686-2.3/Tk/tkImaging.o
> Tk/tkImaging.c:51:16: tk.h: No such file or directory
> Tk/tkImaging.c:73: error: syntax error before "clientdata"
> Tk/tkImaging.c: In function `PyImagingPhotoPut':
> Tk/tkImaging.c:77: error: `Tk_PhotoHandle' undeclared (first use in  
> this function)
> [snip]
> ---
> It looks to me like it can't find the tkImaging headers. How might I  
> be able to work around this or give it access to the headers?

the Python you're using is built with Tkinter, and PIL's setup.py script 
thought that it had found proper header files, but the compiler couldn't 
find them.  since you won't need the Tk stuff for your web application, 
the easiest way to fix this is to trick the setup.py script into 
ignoring the Tkinter extension.

look for this section in the setup.py file:

     import _tkinter
except ImportError:
     _tkinter = None

and change it to

     import _tkinter_is_not_important
except ImportError:
     _tkinter = None

(or something similar; the important thing here is to make sure that the 
_tkinter variable is set to None)


More information about the Image-SIG mailing list