<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CGarvey&#039;s Blog &#187; python</title>
	<atom:link href="http://cgarvey.ie/blog/archive/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://cgarvey.ie/blog</link>
	<description>The personal blog of Irish mobile and web application developer, Cathal Garvey</description>
	<lastBuildDate>Tue, 18 Oct 2011 04:14:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing PIL on Mac OS X Snow Leopard for use in Google App Engine</title>
		<link>http://cgarvey.ie/blog/archive/2010/01/27/installing-pil-on-mac-os-x-snow-leopard-for-use-in-google-app-engine/</link>
		<comments>http://cgarvey.ie/blog/archive/2010/01/27/installing-pil-on-mac-os-x-snow-leopard-for-use-in-google-app-engine/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 02:42:00 +0000</pubDate>
		<dc:creator>cgarvey</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://cgarvey.ie/blog/?p=336</guid>
		<description><![CDATA[A solution to common problems installing PIL on Mac OS X]]></description>
			<content:encoded><![CDATA[<p>Python users who use Django or Google App Engine on the Mac, will likely benefit from the <a href="http://www.pythonware.com/products/pil/" title="Link to the PIL web page">python imaging library (PIL)</a>.<br />
<span id="more-336"></span><br />
However, installing on Mac OS X (Snow Leopard) can be tricky. There are many blog posts on the issue. The most common problem is that PIL and libjpeg (a dependency) seem to install OK, but when you go to use it in your Python code, you get &#8220;_jpeg_resync_to_restart&#8221; errors.</p>
<p>A further complication is the fact that Google App Engine uses Python version 2.5 (and not the default 2.6 that comes with Snow Leopard). If you just need PIL for Django, you can ignore the 2.5 references (i.e. python2.5 becomes python).</p>
<p>Here&#8217;s how I got it working on my machine (the steps are a combination of others&#8217; blog posts, but main credit goes to <a href="http://mtrichardson.com/" title="Link to Michael Richardson's website">Michael Richardson</a>&#8216;s <a href="http://mtrichardson.com/2009/11/pil-libjpeg-snow-leopard-and-missing-_jpeg_resync_to_restart/" title="Link to Michael Richardson's PIL post">post</a>):</p>
<ol>
<li>Download the latest libjpeg .tar.gz (version v7 at time of writing): <a href="http://www.ijg.org/files/">http://www.ijg.org/files/</a>.</li>
<li>Download the latest PIL version for Python 2.5 (v1.17 at time of writing): <a href="http://www.pythonware.com/products/pil/">http://www.pythonware.com/products/pil/</a></li>
<li>Extract libjpeg and do the standard install affair:<code><br />
export CC="gcc -arch i386"<br />
./configure<br />
make<br />
sudo make install<br />
</code> from within the directory. The first line is the gem that many other blog posts leave out (and it assumes you&#8217;re using BASH)</li>
<li>Extract the PIL and change in to that directory.</li>
<li>[optional] libjpeg will have been installed in /usr/local/lib/, by default, above. Normally this directory will be picked up automatically by the PIL install below, but just for good measure (or if you have problems later in the PIL install), edit the <code>setup.py</code>, look for the line <code><br />
JPEG_ROOT = None<br />
</code>. Change that line to <code><br />
JPEG_ROOT=libinclude( "/usr/local" )<br />
</code> and save it.</li>
<li>Install PIL by running <code><br />
sudo python2.5 setup.py install<br />
</code></li>
</ol>
<p>That was enough to get it running for me. I can start App Engine (I use the Google-provided launcher), and use the Image API.</p>
]]></content:encoded>
			<wfw:commentRss>http://cgarvey.ie/blog/archive/2010/01/27/installing-pil-on-mac-os-x-snow-leopard-for-use-in-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

