473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

JPEG decoder not available in PIL

I have a problem which seems to come up from time to time but I can't
find anything relevant in the archives. I have used PIL v1.1.5 with no
problem on Windows for some time but now wish to put it on Linux (Suse
Linux v10.0). I obtained and built the JPEG libraries (jpeg-6b) without
any problem. The tests for the installation work fine. I built Python
2.4.2 from the sources but with no special options, just 'out of the
box'. This works fine. PIL built as it should but the selftest.py fails
with the ‘'decoder jpeg is not available'’ message (the other 54
tests are OK). Other images are opened and shown with xv, no problem. I
think that there is something wrong with the libraries or the way they
linked. ....

At the last moment I managed to solve this problem and I hope it is
worth supplying the details here. First there is a file in the install
directory libImaging/Jpeg.h which has a line:

#include "jpeglib.h"

but there is no such header file. On my system I put:

#include "/usr/local/include/jpeglib.h"

which is where the JPEG installation put the include files for the
library. With this change all 55 tests passed successfully. Then I
copied the PIL library from the installation directory where it was
built to the Python site-packages location. And then everything worked.
For some reason it was not enough to do python setup.py install but
this is probably an artifact of previous failures.

Hope this helps someone ...

Peter

Dec 6 '05 #1
3 4417
Peter wrote:
At the last moment I managed to solve this problem and I hope it is
worth supplying the details here. First there is a file in the install
directory libImaging/Jpeg.h which has a line:

#include "jpeglib.h"

but there is no such header file. On my system I put:

#include "/usr/local/include/jpeglib.h"

which is where the JPEG installation put the include files for the
library. With this change all 55 tests passed successfully.


This is baaaaad! You're mixing two libraries here, for one the system jpeg
library and for another your library. Probably the dynamic loader cache
finds the system library first, so although you included the specifications
for the library you installed to /usr/local, you link against the system
library which might be different (in this case it is not and for jpeglib
will never be, but nevertheless, this is an absolute NONO).

PIL comes precompiled for SuSE, btw., and the package is called Imaging,
IIRC (long time since I've tried SuSE).

Next time round you want to install something, read up on the distinction
between <pkg> and <pkg>-devel. The former contains only the files necessary
at runtime (thus, no static libraries, no headers, etc.), while the latter
contains everything the package installs that isn't in the former. Thus, to
install PIL you should have done:

rpm -Uvv libjpeg-devel-<something>.rpm

or installed

libjpeg-devel

using the SuSE package manager. Then the PIL intallation would have found
the appropriate header files and compiled successfully. Actually, you must
have installed python-devel for the installation package to succeed. Or did
you build Python yourself and overwrote the standard python that was
installed? If so, really do read up on package management using RPM,
there's quite a lot on this on SuSE's site. Otherwise you'll wreck your
system in the longrun...

--- Heiko.
Dec 7 '05 #2
"Peter" wrote:

At the last moment I managed to solve this problem and I hope it is
worth supplying the details here. First there is a file in the install
directory libImaging/Jpeg.h which has a line:

#include "jpeglib.h"

but there is no such header file. On my system I put:

#include "/usr/local/include/jpeglib.h"

which is where the JPEG installation put the include files for the
library.


note that the setup file does in fact pass in /usr/local/include via the
compiler's -I option, so if the above fix made things work, your compiler
setup is pretty weird...

or maybe you have conflicting versions of libjpeg installed in different
locations? (but I don't think there has ever been conflicting releases
of libjpeg, so that doesn't seem likely...)

</F>

Dec 7 '05 #3
On 6 Dec 2005 14:02:37 -0800, Peter wrote:
I have a problem which seems to come up from time to time but I can't
find anything relevant in the archives. I have used PIL v1.1.5 with no
problem on Windows for some time but now wish to put it on Linux (Suse
Linux v10.0). I obtained and built the JPEG libraries (jpeg-6b) without
any problem. The tests for the installation work fine. I built Python
2.4.2 from the sources but with no special options, just 'out of the
box'. This works fine. PIL built as it should but the selftest.py fails
with the ‘'decoder jpeg is not available'’ message (the other 54
tests are OK). Other images are opened and shown with xv, no problem. I
think that there is something wrong with the libraries or the way they
linked. ....


It seems you did not build the RPMs for the JPEG libraries, so the
include files were not placed in the correct location:

# rpm -ql libjpeg-devel
...
/usr/include/jpeglib.h
...

Perhaps you should try "yum install libjpeg libjpeg-devel" if Suse
supports yum.

-Paul

Dec 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: news.west.cox.net | last post by:
I have a fairly simple Python program that uses Image and ImageDraw to create poll results on the fly. Because PIL only supports 256 colors for GIF and BMPs are huge (in comparison)... I have...
0
by: S Etchelecu | last post by:
I'm having trouble understanding the MIME::Decoder usage. Within the context of a MIME email handling program I have an array, @data, and I want to uuencode it. I thought I could instantiate a...
4
by: Laszlo Szijarto | last post by:
anyone know of a JPEG 2000 encoding / decoding library that works with .NET? Thank you, Laszlo
3
by: Mihajlo Cvetanovic | last post by:
After a half hour inet search I'm looking for a link here. Where can I find a cpp source code for in-memory jpeg resizer? Thanks.
9
by: peter.mosley | last post by:
Hello again I'm still wrestling with Python / Tkinter / PIL. I have almost got it to work - on a Fedora Core 1 system I can now display images in a Tkinter window. But I also run a Fedora Core...
0
by: jordi_ramis | last post by:
Hi, I'm looking for a FREE jpeg decoder class or component that lets me: - Load the jpeg from a stream (file). - As an option not to load ALL the jpeg, only the necessary part to make a...
0
by: Jack Wu | last post by:
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...
0
by: YouOverThere | last post by:
I keep getting the error message "IOError: decoder zip not available" when using the Python Imaging Library. The error has occurred when trying to work with PNGs or JPEGs or when loading the fonts...
0
by: Victory | last post by:
Hi, I have looked through the MSDN but looks like there is nothing there that tells me how to use a Decoder object and actually get information about a JPG image. I need to check the frame header...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.