<?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>#pil posts — Ben Crowder</title>
    <link>https://bencrowder.net/blog/tag/pil/</link>
    <atom:link href="https://bencrowder.net/blog/tag/pil/feed/" rel="self" />
    <description>Feed for blog posts tagged with #pil.</description>
    <lastBuildDate>Sat, 04 Apr 2026 05:22:16 GMT</lastBuildDate>
    <language>en-US</language>
    <generator>https://bencrowder.net/</generator>

    <item>
      <title>Installing PIL on Lion</title>
      <link>https://bencrowder.net/blog/2011/installing-pil-on-lion/</link>
      <guid isPermaLink="true">https://bencrowder.net/blog/2011/installing-pil-on-lion/</guid>
      <pubDate>Mon, 08 Aug 2011 12:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Ben Crowder]]></dc:creator>
      <description><![CDATA[<p>Getting PIL working on Lion was a little more difficult than I thought it’d be. (I use PIL in <a href="https://bencrowder.net/coding/ink/">Ink</a> to resize images.) It appeared to install correctly, but when I tried to post something with an image, I got this:</p>
<pre><code>ImportError: The _imaging C module is not installed
</code></pre>
<p>I followed the instructions at <a href="http://appelfreelance.com/2011/07/python-2-7-os-x-lion-and-pil-_imaging-and-image/">appelfreelance.com</a>, but libjpeg wouldn’t compile, giving me this error:</p>
<pre><code>checking build system type... mkdir: /private/tmp/PKInstallSandbox.vMj5ds/tmp: No such file or directory
mkdir: /private/tmp/PKInstallSandbox.vMj5ds/tmp: No such file or directory
config.guess: cannot create a temporary directory in /private/tmp/PKInstallSandbox.vMj5ds/tmp
configure: error: cannot guess build type; you must specify one
</code></pre>
<p>Turns out TotalTerminal had oddly set <code>$TMPDIR</code> to <code>/private/tmp/PKInstallSandbox.vMj5ds/tmp</code>, which obviously broke other things. I cleared it out (<code>export TMPDIR=</code>) and got libjpeg to compile.</p>
<p>But PIL still gave me this error when I tried to <code>import _imaging</code> in Python to test it:</p>
<pre><code>ImportError: dlopen(/Library/Python/2.7/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
  Referenced from: /Library/Python/2.7/site-packages/PIL/_imaging.so
  Expected in: flat namespace
</code></pre>
<p>Oh joy. When I ran <code>otool -L /Library/Python/2.7/site-packages/PIL/_imaging.so</code>, libjpeg didn’t show up in the list, either. I recompiled and reinstalled libjpeg and PIL a few more times. No luck.</p>
<p>The final solution: I installed libjpeg via Homebrew (<code>brew install libjpeg</code>), then compiled and installed PIL (Imaging 1.1.7). That fixed the <code>_imaging.so</code> problem and PIL now works like a charm.</p><hr class="feed-extra" style="margin-top: 48pt;" /><p class="feed-extra feed-mail"><a href="mailto:ben.crowder@gmail.com?subject=Re%3A%20Installing PIL on Lion">Reply via email</a></p>]]></description>
    </item>
    
  </channel>
</rss>
