473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4443
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>.r pm

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
6312
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 opted to create JPEGs. I have installed JPEG-6b and have checked to see that all of the libraries are in the correct, expected places. But, I am...
0
3332
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 MIME::Decoder with an encoding of 'x-uuencode' and then call the encode method as, my $decoder = new MIME::Decoder('x-uuencode');...
4
9639
by: Laszlo Szijarto | last post by:
anyone know of a JPEG 2000 encoding / decoding library that works with .NET? Thank you, Laszlo
3
11342
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
3537
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 3 system, and when I tried the same procedures I get the following errors:- $ python pil_jpg.py Exception in Tkinter callback Traceback (most...
0
1191
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 thumbnail. This is, a faster way to generate thumbnails. Do you know some free class, component or piece of code that I can
0
2209
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 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...
0
2647
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 supplied with PIL. I can work with GIFs. I assume that I did something wrong when I built Python and/or PIL, but I'm at a loss as to what. I am...
0
1228
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 and see what type of DCT the image is made with like DCT with Huffman coding or Extended sequential DCT with arithmetic coding. Any help is...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.