FAQ

[Image-SIG] Unable to import _imaging

Esben Bugge
Nov 6, 2010 at 9:30 pm
Hi

I am trying to install PIL on Mac OS.X 10.6 for the purpose of using
Satchmo. After installation I tried

$ python
import PIL
import Image
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 believe that jpeglib (version 7) is properly installed: I am able to run
the tests that are provided with the source of jpeglib.

I am quite new to installing stuff via the command-line. I did a lot of
searches on Google and found some guys with the same problem - but I have
not been able to find a solution that fixes the problem for me. Any ideas on
what I can check?

Any help appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20101106/466d30e7/attachment.html>
reply

Search Discussions

3 responses

  • Fredrik Lundh at Nov 6, 2010 at 11:46 pm

    On Sat, Nov 6, 2010 at 10:30 PM, Esben Bugge wrote:
    Hi

    I am trying to install PIL on Mac OS.X 10.6 for the purpose of using
    Satchmo. After installation I tried

    $ python
    import PIL
    import Image
    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 believe that jpeglib (version 7) is properly installed: I am able to run
    the tests that are provided with the source of jpeglib.

    I am quite new to installing stuff via the command-line. I did a lot of
    searches on Google and found some guys with the same problem - but I have
    not been able to find a solution that fixes the problem for me. Any ideas on
    what I can check?
    I *think* this is caused by a mismatch between jpeg-6a and jpeg-7 (or
    8 or whatever the latest is) -- i.e. your compiler picks up the header
    files for one of them, but when you run the program, the runtime
    linker pulls in the other one and gets confused. I know absolutely
    nothing about the Mac OS X build & execution environment, though, so I
    don't know where to look for that conflict.

    The comments to this blog post contain several workarounds that may or
    may not solve your problem:

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

    but for this non-Mac user, compiling stuff on Mac OS X seems to be
    about as fragile as getting audio stuff to work on Linux :)

    (This mail list is full of competent Mac hackers, though, so hopefully
    one of them has more useful advice)

    </F>
  • Christopher Barker at Nov 8, 2010 at 5:21 pm

    On 11/6/10 2:30 PM, Esben Bugge wrote:
    I am trying to install PIL on Mac OS.X 10.6 for the purpose of using
    Satchmo. After installation I tried
    getting PIL built on OS-X is a bit of a pain. If you want to run it just
    on your system, the easiest way is to get the dependencies from
    macports, and then build PIL with those.

    A note: OS-X generally (always?) hard-codes the path to dependent libs
    when linking. so you can do:

    otool -L _imaging.so

    and you should see what it's linked against.

    But far easier is to install a binary. Russell Owen has built some, that
    you can find here:

    <http://www.astro.washington.edu/users/rowen/python/>

    Fredrik: please put these up the PIL site!

    -Chris




    --
    Christopher Barker, Ph.D.
    Oceanographer

    Emergency Response Division
    NOAA/NOS/OR&R (206) 526-6959 voice
    7600 Sand Point Way NE (206) 526-6329 fax
    Seattle, WA 98115 (206) 526-6317 main reception

    Chris.Barker at noaa.gov
  • Esben Bugge at Nov 8, 2010 at 6:35 pm
    otool -L _imaging.so

    gave me

    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
    (architecture ppc):
    /usr/lib/libmx.A.dylib (compatibility version 1.0.0, current version
    315.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
    125.2.0)
    /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/PIL/_imaging.so
    (architecture i386):
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
    125.2.0)

    That doesn't mention anything about jpeg...?

    Anyway, I used the binaries and now it seems to work just fine :)
    On 8 November 2010 18:21, Christopher Barker wrote:
    On 11/6/10 2:30 PM, Esben Bugge wrote:

    I am trying to install PIL on Mac OS.X 10.6 for the purpose of using
    Satchmo. After installation I tried
    getting PIL built on OS-X is a bit of a pain. If you want to run it just on
    your system, the easiest way is to get the dependencies from macports, and
    then build PIL with those.

    A note: OS-X generally (always?) hard-codes the path to dependent libs when
    linking. so you can do:

    otool -L _imaging.so

    and you should see what it's linked against.

    But far easier is to install a binary. Russell Owen has built some, that
    you can find here:

    <http://www.astro.washington.edu/users/rowen/python/>

    Fredrik: please put these up the PIL site!

    -Chris




    --
    Christopher Barker, Ph.D.
    Oceanographer

    Emergency Response Division
    NOAA/NOS/OR&R (206) 526-6959 voice
    7600 Sand Point Way NE (206) 526-6329 fax
    Seattle, WA 98115 (206) 526-6317 main reception

    Chris.Barker at noaa.gov
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/image-sig/attachments/20101108/bbb334af/attachment.html>

Related Discussions

Discussion Navigation
viewthread | post