Install Python Imaging Library (PIL) on Cygwin
I’ve just managed to get Django up and running on Cygwin.
I have to say that getting PIL to build was a real pain in the neck (Python Imaging Library – required for ImageField). In the hope that I may save others from this pain, here is the solution.
You need to compile PIL from source so make sure you have gcc installed (in cygwin). There’s a handy installation helper in the cygwin setup package list called, ‘gcc: C compiler upgrade helper’. Install this, and it grabs the dependencies.
PIL Python Imaging Library
Get the PIL source from here, and unpack the archive to your sources folder (I use /home/rich/sources).
Now, if you run python setup.py install, the installation hangs (for me anyway). Googling reveals that this is not uncommon. What you need to do is ‘rebase’! Sound like a crack issue… maybe it is?
Here’s the magic command (and don’t ask me why this works):
rebase -b 0x1000000000 /bin/tk84.dll
So, close cygwin and open up task manager, kill any gcc.exe or python.exe processes that are hanging around. Next, run the above command. You should then be able to install using setup.py as normal.
python setup.py install
A big thank you to Ross Patterson for publicising this solution.
Installing PIL on Cygwin was published on Jetfar.com.
Thanks. This was a maddening problem
Amit Jain
June 26, 2008 at 11:05 am
This worked for me (Imaging-1.1.6)
james
June 28, 2008 at 2:30 pm
Wow!
ryan
July 6, 2008 at 3:20 am
Thanks, Richard! Interestingly, the package also compiled much faster after this
Farhan Ahmad
July 23, 2008 at 3:00 pm
thank you!
Mark
August 30, 2008 at 12:17 am
Great fix man. Thanks heaps for that.
Matthew Sherborne
September 5, 2008 at 12:28 am
GREAT FIX.
THANK YOU SO MUCH.
someone
September 30, 2008 at 7:52 am
Thanks very much. I’ve been struggling with these hanging installations for months, and your fix has got me back on track. Yay!
Steve Holden
October 22, 2008 at 1:00 pm
I was able to build the PIL using this fix, but it apparently broke the Tkinter. Now when I try running a tkinter application, i get this error:
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 38, inimport _tkinter # If this fails your Python may not be configured for Tk
ImportError: Permission denied
Any help, please?
Rich: Sorry mate, I haven’t done any non-web work in years, let alone GUI. Good luck!
NdrU
November 16, 2008 at 1:56 pm
All I’ve been trying to do is display a jpeg using python on Cygwin… you would think that Cygwin maintainers would have added this functionality, but no. Thanks for the fix!
Michael Sander
February 5, 2009 at 12:38 pm
re: NdrU “it apparently broke the Tkinter” … “ImportError: Permission denied”
same here -> fixed by running “rebaseall”
Dan Freeman
March 16, 2009 at 7:23 pm
Just a quick ‘thank you’. This worked a treat with PIL 1.1.6
Andrew Mason
May 8, 2009 at 7:07 pm
Thank you!
Fonso
May 24, 2009 at 10:18 pm
Instead of diddling with the system’s Tk DLL, you could also just disable Tk support in PIL. While the setuptools script doesn’t have any flags, you could easily just make it think that Tkinter isn’t installed:
sed -i -e ’s/import _tkinter/raise ImportError/’ setup.py
Fred Blasdel
July 8, 2009 at 3:09 pm
That helped
Tijmen
July 21, 2009 at 11:39 pm
worked for me, too, but I needed to rebase using the “ash” terminal.
Thanks!
Oxenfrogga
July 22, 2009 at 6:11 pm
[...] At least the native Python 2.6 on Snow Leopard works great, and this wasn’t nearly as painfull as installing PIL on Cygwin! [...]
libjpeg and Python Imaging (PIL) on Snow Leopard
September 5, 2009 at 10:05 pm
Thanks!
Matt
September 9, 2009 at 9:04 pm