views:

608

answers:

2

I followed these instructions:

http://proteus-tech.com/blog/cwt/install-pil-in-snow-leopard/

And everything went as described.

However, at the end, I tried running:

python selftest.py

to verify that everything is working properly, but I get:

*** The _imaging C module is not installed

I then run the python interpreter and tried:

import _imaging

and get this error:

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

This is on my first Mac, so apologize if I'm missing anything obvious, but any help you could provide would be greatly appreciated.

Thanks!

A: 

The problem happens because jpeglib is not available as part of standard MAC OS X distribution for Leopard and Snow Leopard.

The solution is as follows: - compile lib jpeg - make sure tha libjpeg62.dylib is available on your DYLD_LIBRARY_PATH (you might like to put it in places like /usr/local/lib)

Useful instructions are available here

Shailesh Kumar
Thanks. I followed those instructions, but when I run: pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz I get: -bash: pip: command not foundWhat is pip and how do I get in on my Mac? Again, apologies for the simplistic questions (as I am still very new to all of this).
ryan
Ok, nevermind, I got pip running. Another question for you: I navigated to /usr/local/lib and see the following files there: libjpeg.7.dylib, libjpeg.a, libjpeg.dylib, libjpeg.la, but not libjpg62.dylib. Do you know where that file is installed to by default (or how I can find it and move it to this folder)
ryan
I have earlier used libjpeg62.dylib. I think I never went over to the 7 version. Unix .so files are known as .dylib files in MAC world. In your case, its the libjpeg.7.dylib which should be relevant. This I presume is version 7 release of JPEG LIB. The installation has happened at the right place which is /usr/local/lib. Thats where it gets installed when you run $make install. As such you can have the dynamic libraries anywhere in your file system as long as those directories are on your DYLD_LIBRARY_PATH environment variable. Hope this helps.
Shailesh Kumar
A: 

Ok, got it working thanks to Shailesh's help. First, I ran this:

otool -L /Library/Python/2.6/site-packages/PIL/_imaging.so

to see where the dependencies were. I removed those references to libjpeg, and then recompiled libjpeg and PIL (following the instructions in the link below) and then everything worked.

http://jetfar.com/libjpeg-and-python-imaging-pil-on-snow-leopard/

ryan