Unable to initialize images API - ImportError: No module named PIL

4,028 views
Skip to first unread message

Sarath Chandra Pandurangi

unread,
May 30, 2008, 8:12:21 PM5/30/08
to Google App Engine
I am getting this, after upgrading to GAE 1.1.

Could not initialize images API; you are likely missing the Python
"PIL" module. ImportError: No module named PIL

How do i resolve this?
Sarath.

Paul

unread,
May 30, 2008, 8:29:47 PM5/30/08
to Google App Engine
You have to install the PIL module before using the new SDK.
Instructions for various platforms are located here:
http://code.google.com/appengine/docs/images/installingPIL.html

Duncan

unread,
May 31, 2008, 7:41:27 AM5/31/08
to Google App Engine
On May 31, 1:29 am, Paul <Paul.McDon...@gmail.com> wrote:
> You have to install the PIL module before using the new SDK.
> Instructions for various platforms are located here:http://code.google.com/appengine/docs/images/installingPIL.html
>
One point to note, at least for Windows users, is to resist the
temptation to try to install PIL using easy_install. On Windows the
command "\Python25\Scripts\easy_install PIL" will download and install
a PIL egg, but it does set up the path correctly so "import PIL" will
still fail. (For those that haven't realised it yet most Python
packages these days can be installed with easy_install, it's a bit
annoying that PIL is broken that way.)

fczuardi

unread,
Jun 2, 2008, 3:16:40 AM6/2/08
to Google App Engine

Anyone have managed to install PIL on Leopard?

I tried the installer recommended in the google documentation page,
but it was for mac os 10.4, and it couldnt install...

Then I followed the instructions on this page: http://wiki.python.org/moin/MacPython/Leopard
and tried to install the same PIL binary again, the installer went
until the end and told me it was successful, but trying to initialize
the sdk still gives me the error:

WARNING 2008-06-02 07:07:40,983 dev_appserver.py] Could not
initialize images API; you are likely missing the Python "PIL" module.
ImportError: No module named PIL

So I am not sure if the thing installed correctly, on the right Python
framework (I want to continue using the 2.5.1 that comes with
leopard).

If anyone got it working on Leopard please share the instructions :)

BTW, I am a Python newby...

[]s


On May 31, 4:41 am, Duncan <kupu...@googlemail.com> wrote:
> On May 31, 1:29 am, Paul <Paul.McDon...@gmail.com> wrote:> You have to install thePILmodule before using the new SDK.
> > Instructions for various platforms are located here:http://code.google.com/appengine/docs/images/installingPIL.html
>
> One point to note, at least for Windows users, is to resist the
> temptation to try to installPILusing easy_install. On Windows the
> command "\Python25\Scripts\easy_installPIL" will download and install
> aPILegg, but it does set up the path correctly so "importPIL" will

Nigel Bruin

unread,
Jun 2, 2008, 10:16:52 AM6/2/08
to google-a...@googlegroups.com
On 2 Jun 2008, at 15:16, fczuardi wrote:
> Anyone have managed to install PIL on Leopard?

Yes.

Download PIL: http://effbot.org/downloads/Imaging-1.1.6.tar.gz

Install: "sudo python setup.py install"

It didn't work initially so I did some other things as recommended here:
http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html
but now I've fixed the app code, I have now backed out both the
Frameworks
and bash_login suggestions and it still works for me.

rgds,
Nigel Bruin

MacOS 10.5.3, PPC.

Fabricio Zuardi

unread,
Jun 3, 2008, 1:03:09 AM6/3/08
to google-a...@googlegroups.com
Thanks! that worked! :)

--
Fabricio C Zuardi
http://cchits.org

RyanW

unread,
Jul 6, 2008, 2:28:09 PM7/6/08
to Google App Engine
I'm having a similar problem. I usually run the SDK in cygwin on my
windows box. I ran into this problem, installed PIL using the windows
installer, and it won't work in cygwin. I can run it through the
windows Command Prompt just fine but it won't run under cygwin.

I then grabbed the "source" package they have available, unpacked it,
and tried a "setup.py install" in cygwin. It failed with the
following error:
creating build/temp.cygwin-1.5.25-i686-2.5
creating build/temp.cygwin-1.5.25-i686-2.5/libImaging
gcc -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -
DHAVE_LIBZ -IlibImaging -I/usr/include -I/usr/includ
e/python2.5 -c _imaging.c -o build/temp.cygwin-1.5.25-i686-2.5/
_imaging.o
5 [main] python 4188 C:\bin\cygwin\bin\python.exe: *** fatal
error - unable to remap C:\bin\cygwin\bin\tk84.dll to
same address as parent(0x18710000) != 0x18C10000
107 [main] python 5852 fork: child 4188 - died waiting for dll
loading, errno 11
error: Resource temporarily unavailable
~/downloads/Imaging-1.1.6 >

So anyone ever get this to run under cygwin?

On May 30, 5:12 pm, Sarath <sarath...@yahoo.com> wrote:

David Webb

unread,
Jul 7, 2008, 5:43:17 AM7/7/08
to google-a...@googlegroups.com
I don't know about Cygwin, but if you're writing a GAE application there's no point getting PIL to work on your development App Server.

PIL contains native C code and as such you won't be able to get it running on the Google servers.  You can only upload pure Python modules as part of your application.

There is a GAE image API that allows for some basic image processing:

http://code.google.com/appengine/docs/images/
http://code.google.com/appengine/articles/images.html

2008/7/6 RyanW <red...@gmail.com>:

David Symonds

unread,
Jul 7, 2008, 5:55:48 AM7/7/08
to google-a...@googlegroups.com
On Mon, Jul 7, 2008 at 7:43 PM, David Webb <dave...@gmail.com> wrote:

> I don't know about Cygwin, but if you're writing a GAE application there's
> no point getting PIL to work on your development App Server.
>
> PIL contains native C code and as such you won't be able to get it running
> on the Google servers. You can only upload pure Python modules as part of
> your application.
>
> There is a GAE image API that allows for some basic image processing:

Erm, the dev_appserver uses PIL to emulate the images API locally (see
http://code.google.com/appengine/docs/images/overview.html). If you
want to test your use of the images API locally, you *must* have PIL
installed.


Dave.

David Webb

unread,
Jul 7, 2008, 5:58:34 AM7/7/08
to google-a...@googlegroups.com
Erm, the dev_appserver uses PIL to emulate the images API locally (see
http://code.google.com/appengine/docs/images/overview.html). If you
want to test your use of the images API locally, you *must* have PIL
installed.

 So you do.  Whoops.  Sorry about that.

David Symonds

unread,
Jul 7, 2008, 6:00:55 AM7/7/08
to google-a...@googlegroups.com

It's still worth noting that you *only* need it for the images API. If
you aren't wanting to use the images API through dev_appserver, you do
*not* need PIL installed, and can safely ignore the error message.


Dave.

RyanW

unread,
Jul 7, 2008, 1:24:24 PM7/7/08
to Google App Engine
I goofed, you're right. I thought it was the PIL package that was
causing it to error. It was actually because I had another
application listening on port 8080. Changed the port and it's running
the service with the PIL error now.

Still, has anyone gotten PIL to work under cygwin?

On Jul 7, 3:00 am, "David Symonds" <dsymo...@gmail.com> wrote:

JLD000

unread,
Aug 31, 2008, 5:36:50 AM8/31/08
to Google App Engine
http://jetfar.com/cygwin-install-python-imaging-library/

This worked for me. (using Imaging-1.1.6)

Fred

unread,
Oct 16, 2008, 7:32:53 AM10/16/08
to Google App Engine
To get this working on Leopard, I ran the installers as suggested in
the GAE docs, but I kept on getting the 'ImportError: No module named
PIL' error message.

I tried the suggestions listed on
http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html
but this made no difference. So, in the end I simply copied the
PIL.pth file and PIL directory from /Library/Frameworks/
Python.framework/Versions/2.5/lib/python2.5/site-packages to /Library/
Python/2.5/site-packages and this appears to be working OK.

Giacecco

unread,
Oct 18, 2008, 2:57:21 PM10/18/08
to Google App Engine
Fred's solution is the only one that worked for me. Rather than
copying PIL and PIL.pth, I soft-linked them.

G.

On Oct 16, 12:32 pm, Fred <fred.leef...@gmail.com> wrote:
> To get this working on Leopard, I ran the installers as suggested in
> the GAE docs, but I kept on getting the 'ImportError: No module named
> PIL' error message.
>
> I tried the suggestions listed onhttp://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1...
Reply all
Reply to author
Forward
0 new messages