I installed libjpeg and PIL, but when I try to save a JPG image, I always get this error:
ImportError: The _imaging C module is not installed
Any help much appreciated!
I tried to import _imaging w/ Python interpreter to see what's wrong 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
I just hit this as well on SL, and the problem is likely your libjpeg was built without a matching architecture. Assuming you're using MacPorts, run file /opt/local/lib/libjpeg.dylib. The right way is to build everything with MacPorts as +universal, see
Universal Binaries in MacPorts as it relates to PIL dependencies.
A lot of these errors happen when compiling from source when you've previously installed python tools from fink or ports. For example the _jpeg_resync_to_restart error can happen when you've got leftover libjpeg files in /opt/local/lib. Try this:
cd /opt/local/lib
sudo rm *jpeg*
Then recompile libjpeg (starting with make clean), then recompile PIL (starting with rm -Rf build).
After that, import _imaging should work. Did for me anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With