DIDoS
DIDoS

Reputation: 822

PIL installation under CentOS selftest fine but jpeg not working

I built and installed PIL on my CentOS 6.2 with Python 2.7 by executing build, build_ext -i and install. I had to change the library paths so that all supports are given. When I run the selftest.py it says that everything is ok and all supports are given (especially JPEG).

When running my program which opens a jpeg, adds something, and saves it I get the error:

  File "/opt/python2.7.2/lib/python2.7/site-packages/PIL/Image.py", line 401, in _getencoder
    raise IOError("encoder %s not available" % encoder_name)
IOError: encoder jpeg not available

My program works fine on other systems and it runs on the centOS machine fine when I change it to png. I ran all commands with python2.7, and I already tried to reinstall PIL.

So in short: before installing PIL it runs within the selftest successfully, but after installing it it does not work any more.

Upvotes: 1

Views: 1842

Answers (1)

DIDoS
DIDoS

Reputation: 822

I found the solution in the ubuntu forums

1/ Call 'pip install -I pil --no-install' to download and unpack the PIL source into your 
build directory;
2/ Get into your build directory and edit setup.py;
3/ Find the line that says 'add_directory(library_dirs, "/usr/lib")' (line 214 here);
4/ Add the line 'add_directory(library_dirs, "/usr/lib/i386-linux-gnu")' afterwards;
5/ Call 'pip install -I pil --no-download' to finish the installation.

Upvotes: 2

Related Questions