Help with JPEG support with PIL 1.1.5 and OSX

Jack Wu wulabs at gmail.com
Fri Sep 22 02:47:52 EDT 2006


Hi

I've spent a good majority of my day trying to figure out how to have
PIL 1.1.5 working on my OSX 10.3.9_PPC machine.  I'm still stuck and I
have not gotten anywhere.  Could somebody please help me...

I've scoured all the documentation, google, and mailing lists to no
avail.  I believe the problem may lay in a jpeglib problem with OSX
10.3.9, or a python paths problem.

Here is info on my system (note this is not the default Python version
that comes with OSX):
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin

This email is really long, I've seperated the sections with 3-4 lines
of spacing.





Here is my own PIL installation summary, I followed directions in
README.  I am using the most recent install package from the PIL
website.  I also tried using the default JPEG_ROOT=None and JPEG_ROOT
= "sw/lib", where I was able to locate the jpeglib files.
---------------------------------------------------------------------------------------
running install
running build
running build_py
running build_ext
--------------------------------------------------------------------
PIL 1.1.5 BUILD SUMMARY
--------------------------------------------------------------------
version       1.1.5
platform      darwin 2.4.1 (#2, Mar 31 2005, 00:05:10)
              [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
running build_scripts
running install_lib
running install_scripts
changing mode of
/Library/Frameworks/Python.framework/Versions/2.4/bin/pilconvert.py to
755
changing mode of
/Library/Frameworks/Python.framework/Versions/2.4/bin/pildriver.py to
755
changing mode of
/Library/Frameworks/Python.framework/Versions/2.4/bin/pilfile.py to 755
changing mode of
/Library/Frameworks/Python.framework/Versions/2.4/bin/pilfont.py to 755
changing mode of
/Library/Frameworks/Python.framework/Versions/2.4/bin/pilprint.py to
755
creating
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packag
es/PIL.pth
---------------------------------------------------------------------------------------
This file was 212KB.





I tried running the self-test and this is my output:
*****************************************************************
Failure in example: _info(Image.open("Images/lena.jpg"))
from line #24 of selftest.testimage
Exception raised:
Traceback (most recent call last):
  File "./doctest.py", line 499, in _run_examples_inner
    exec compile(source, "<string>", "single") in globs
  File "<string>", line 1, in ?
  File "./selftest.py", line 21, in _info
    im.load()
  File "PIL/ImageFile.py", line 180, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "PIL/Image.py", line 328, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
1 items had failures:
   1 of  55 in selftest.testimage
***Test Failed*** 1 failures.
*** 1 tests of 55 failed.







I ran "$python -vv -c "import _imaging"" and this was the important output:
------------------------------------------------------------------------
import _imaging # dynamically loaded from
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PIL/_imaging.so
------------------------------------------------------------------------
This file was 962KB.



The _imaging.so file mentioned above (962KB) was not actually the same
one that I compiled earlier (212KB).  So I figured there must be some
problem with my python path.  I copied the newly compiled version into
the python PIL directory above and tried again.  Same problem on self
test.




I then tried the Darwin ports py-pil (http://py-pil.darwinports.com/).
 This is the output that I got when installing:
------------------------------------------------------------------------
sudo port install py-pil
--->  Fetching freetype
--->  Attempting to fetch freetype-2.1.10.tar.bz2 from
http://download.savannah.gnu.org/releases/freetype/
--->  Verifying checksum(s) for freetype
--->  Extracting freetype
--->  Applying patches to freetype
--->  Configuring freetype
--->  Building freetype with target all
--->  Staging freetype into destroot
--->  Packaging tgz archive for freetype 2.1.10_1
--->  Installing freetype 2.1.10_1
--->  Activating freetype 2.1.10_1
--->  Cleaning freetype
--->  Fetching jpeg
--->  Attempting to fetch jpegsrc.v6b.tar.gz from http://www.ijg.org/files
--->  Verifying checksum(s) for jpeg
--->  Extracting jpeg
--->  Applying patches to jpeg
--->  Configuring jpeg
--->  Building jpeg with target all
--->  Staging jpeg into destroot
--->  Packaging tgz archive for jpeg 6b_1
--->  Installing jpeg 6b_1
--->  Activating jpeg 6b_1
--->  Cleaning jpeg
--->  Fetching py-pil
--->  Attempting to fetch Imaging-1.1.5.tar.gz from http://effbot.org/downloads/
--->  Verifying checksum(s) for py-pil
--->  Extracting py-pil
--->  Applying patches to py-pil
--->  Configuring py-pil
--->  Building py-pil with target build
--->  Staging py-pil into destroot
--->  Packaging tgz archive for py-pil 1.1.5_1
--->  Installing py-pil 1.1.5_1
--->  Activating py-pil 1.1.5_1
--->  Cleaning py-pil
------------------------------------------------------------------------
This created a _imaging.so file which was 684KB.



I copied this newly created _imaging.so file into my appropriate
python PIL directory and ran self-test again, and it still had the
same error.





Another test I did was to remove _imaging.so completely from the PIL
directory in Python.  When I ran (python -vv -c "import _imaging"),
this was the output:
------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named _imaging
------------------------------------------------------------------------
But self_test.py still had the same output as before (JPEG decode error).




I also downloaded jpeglib(jpeg-6b) and built it myself (succesfully),
and passed the lib directory for JPEG_ROOT in the PIL installer, but
that didn't have any different self-test results.

It is also very strange that i can set the JPEG_ROOT to be anything,
even something ficticious and the installer will report 'no support
errors' for JPEG.




Another strange thing is a discprency in JPEG libraries, py-pil seems
to use JPEG while PIL seems to reference only LIBJPEG.




Running a search on my HD for _imaging.so turns up 4 sources:
1) /opt/local/lib/python2.4/site-package/PIL/_imaging.so (684KB - this
was generated by the py-pil install)
2) /opt/local/var/db/dports/software/py-pil/1.1.5_1/opt/lcoal/lib/python2.4/site-packages/PIL/_imagin.so
(684KB - this was generated by the py-pil install)
3) Desktop/Imaging-1.1.5/PIL/_imaging.so (212KB - this was generated
by the PIL Imaging isntall)
4) Desktop/Imaging-1.1.5/build/lib.darwin-7.9.0-Power_macintosh-2.4/_imaging.so
(212KB - this was generated by the PIL Imaging install)



My goal is to get the self-test working properly.  Somebody please help!
-- 
Jack Wu



More information about the Python-list mailing list