Playing with the new Google App Engine Launcher this evening I spotted this warning every time the dev_appserver server kicked up:
WARNING 2009-08-10 22:37:23,407 dev_appserver.py:3358 Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging |
A comment from praseodym on the GAE Cookbook recipe Install PIL in Mac OS X provided this one liner:
sudo easy_install --find-links http://www.pythonware.com/products/pil/ Imaging |
I ran the command in Terminal and was impressed with a speedy auto install and, ignoring a few errors in the verbose output, restarted the dev_appserver. Same warning!
It quickly dawned that my shell Python is 2.6.2 and the dev_appserver calls a different version as evidenced in the logs:
*** Running dev_appserver with the following flags:
--admin_console_server= --port=8080
Python command: /usr/local/bin/python2.5 |
Attempting to force GAE to use my shell Python (which python) using the preferences tab didn’t work so I set about following the original recipe with my own small garnish. I followed the instructions to download and unpack PIL from http://effbot.org/downloads/Imaging-1.1.6.tar.gz but explicitly told setup.py to use my 2.5 installation like this:
sudo python2.5 setup.py install |
A quick restart of the server and the original import error has successfully gone.
Powered by Wordpress
Using the 960 Grid System CSS layout framework


2 responses so far ↓
1 Nicolas Ameghino // Nov 1, 2009 at 8:48 am
Hello! I’ve had the same issue.
I solved it by linking the site-packages directory from the OS, so when you easy-install something (and gets installed into the system-included python), it’s also available to the fink python:
sudo ln -s /Library/Python/2.6/site-packages/ /sw/lib/python2.6/site-packages
Hope it helps anyone!
2 Laurent // Mar 3, 2010 at 9:27 am
Thanks for this useful tip !
I was able to install directly into python 2.5 using:
sudo easy_install-2.5 –find-links http://www.pythonware.com/products/pil/ Imaging
I had a problem with the python path settings too (I wanted to force python 2.5 instead of 2.6 to match google’s production version), but have been able to fix it. I believe the problem was caused by using the symlink path of python (/usr/bin/python2.5). I replaced it with the actual absolute path pointed by the symlink (/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5) and it worked. It might help someoneā¦
Leave a Comment