Snow Leopard Python 2.6 problems getting PIL to work

I have installed libjpeg and PIL, but when I try to save the JPG image, I always get this error:

ImportError: module _imaging C not installed

Any help is greatly appreciated!

I tried to import the _imaging w / Python interpreter to see what happened and got this:

    >>> import _imaging
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so, 2): Symbol not found: _jpeg_resync_to_restart
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
  Expected in: dynamic lookup

      

+2


source to share


4 answers


I just hit this on SL as well and the problem is your libjpeg was built without the corresponding architecture. Assuming you are using MacPorts, run file /opt/local/lib/libjpeg.dylib

. The correct way is to build everything with MacPorts as +universal

see Generic Binaries in MacPorts as it relates to PIL dependencies.



+4


source


Many of these errors occur when compiling from source when you have previously installed python tools from fink or ports. For example, an error _jpeg_resync_to_restart

can occur if you have leftover libjpeg files in /opt/local/lib

. Try the following:

cd /opt/local/lib
sudo rm *jpeg*

      



Then recompile libjpeg (starting at make clean

), then recompiling PIL (starting at rm -Rf build

).

After that it import _imaging

should work. It's all the same to me.

+4


source


Edit: Thanks for the added bug report. This appears to be a jpeglib issue on Snow Leopard. Have you tried this?

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

+2


source


I had this problem too. This turned out to be due to a change I made to my .bash_profile (forcing it to use ggc-4.0) when trying to fix a MySQLdb installation issue.

http://www.brambraakman.com/blog/comments/installing_pil_in_snow_leopard_jpeg_resync_to_restart_error/

+1


source







All Articles