libjpeg symbol not found error with PIL on 10.6 Snow Leopard

If you get the following error, while Installing PIL on Mac OS X 10.6 Snow Leopard read on for a possible solution:

>>> from PIL import _imaging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/, 2): \
Symbol not found: _jpeg_resync_to_restart
  Referenced from: /Library/Python/2.6/site-packages/PIL/
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/PIL/

Popular how-tos on the web indicated that it is neccessary to force Python on Snow Leopard in 32bit mode to be able to install the Psycopg2 adapter for PostgreSQL.

So you might have used the following command on your system:

defaults write Prefer-32-Bit -bool yes

Now you get the traceback shown above while installing or using PIL. This might result from an module (for PIL) build with a 64bit version of libjpeg, which now fails to load in a 32bit python interpreter.

We were able to solve the problem by installing a universal libjpeg package, found here: and recompiling PIL to use this libjpeg version. Now PIL works in 32bit and 64bit mode.