Installing pillow on windows fails to find libjpeg - python

Sys: Windows 7 Prof;
Python v3.3
I've tried to use:
'easy_install Pillow'
'pip install use-wheel Pillow'
Download package manually and 'python setup.py install'
but all the time i cant install any extensions:
*** TKINTER support not available
(Tcl/Tk 8.5 libraries needed)
*** JPEG not support available
*** ZLIB (PNG/ZIP) support not available
*** TIFF G3/G4 (experimental) support not available
*** FREETYPE2 support not available
*** LITTLECMS support not available
*** WEBP support not available
I've manually installed libjpeg but still the results were the same. I've alsot tried to change JPEG_ROOT path to point it somehow to the correct dll but it did not work too.
Any idea how to solve this?

try python extension packages for windows:
http://www.lfd.uci.edu/~gohlke/pythonlibs/
There are 32- and 64-bit Windows binaries you can simply install

Related

Libtiff not listed in library path on Win 7

After successfully installing libtiff on win7 I try to run:
tif = TIFF.open("sometiff.tiff")
I get the following error:
File "C:\Python27\ArcGIS10.2\lib\site-packages\libtiff\libtiff_ctypes.py",
line 41, in <module> raise
ImportError: Failed to find TIFF library.
Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|..
I'm not sure what I need to add to the windows path to make this work successfully.
The directory that contains the dll for libtiff needs to be in your PATH environment variable.
If you did pip install libtiff, then you would have installed it using libtiff from pypi. This seems to be a "wrapper" around libtiff, so you will also need to install the actual libtiff Setup program.
Depending on what you are doing, you may want to look into a more complete distribution of python on windows such as Anaconda, which seems to be quite popular, or Enthought, which the subscription version is well supported. (I believe there is a subscription version of Anaconda, but I have not used it.)

OS X virtualenv Pillow and Jpeg support

I have Pillow working on my OS X Mavericks machine. But when I try to install it in a virtualenv, I can't seem to get JPEG support working.
Here's the summary output of pip install Pillow in the virtualenv:
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 2.5.3
platform darwin 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
--------------------------------------------------------------------
--- TKINTER support available
*** JPEG support not available
*** OPENJPEG (JPEG2000) support not available
--- ZLIB (PNG/ZIP) support available
*** LIBTIFF support not available
*** FREETYPE2 support not available
*** LITTLECMS2 support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------
It seems I could try to edit setup.py to point to the relevant libs, but I'm new to virtualenv, and don't know where setup.py is.
EDIT:
Well, I solved it by linking from the virtualenv to the working Pillow library.
You should install libjpeg first, as the doc says:
http://pillow.readthedocs.org/en/latest/installation.html#external-libraries
libjpeg provides JPEG functionality.
Install libjpeg using homebrew: brew install libjpeg
So, my solution was to link to the working install of Pillow from the virtualenv.

Pillow recognizes JPEG encoder on install, but not use

I'm doing some work on a vagrant box running Ubuntu 13.04 and python 3.3. I've installed Pillow and libjpeg-dev (installing the latter first, as recommended), and when I install (or re-install Pillow, I see this:
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 2.3.0
platform linux 3.3.1 (default, Sep 25 2013, 19:29:01)
[GCC 4.7.3]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
Great! JPEG encoder recognized. Except, when I run Pillow's selftest.py script, it fails a bunch of tests and starts off with this:
--------------------------------------------------------------------
Pillow 2.3.0 TEST SUMMARY
--------------------------------------------------------------------
Python modules loaded from /usr/local/lib/python3.3/dist-packages/PIL
Binary modules loaded from /usr/local/lib/python3.3/dist-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
*** JPEG support not installed
--- ZLIB (PNG/ZIP) support ok
So now it's not recognizing the JPEG decoder. To make sure this isn't just a problem with selftest.py, I did my testing and sure enough I can make and manipulate .pngs but not .jpgs. I've searched around and tried some suggested solutions, including making a symbolic link to the jpg library, like so:
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
No dice. Anybody have an idea of something else I could try to get the jpeg decoder working? It really isn't practical for me to restrict the workflow entirely to .png.
And, this is why I need to wait 24 hours before posting questions. I needed to pay attention to the Pillow install path. It works if I create the symlink like so:
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/local/lib/
/usr/lib wasn't in the Pillow search path, but the above is.

PNG display in PIL broken on OS X Mavericks?

I've noticed that PNG images aren't displaying in Tkinter apps using ImageTk.PhotoImage in OS X Mavericks. But, GIFs and JPEGs display fine. There's no error printed or exception thrown and debugging the code shows the image is read and has the correct height & width. Here's a simplified example:
import Tkinter
from PIL import Image, ImageTk
logo_file = 'test.png'
#logo_file = 'test.gif'
class Application(Tkinter.Frame):
def __init__(self, master):
Tkinter.Frame.__init__(self, master)
self.master.minsize(width=512, height=256)
self.master.config()
self.pack()
self.main_frame = Tkinter.Frame()
self.some_image = ImageTk.PhotoImage(Image.open(logo_file))
some_label = Tkinter.Label(self.main_frame, image=self.some_image)
some_label.config()
some_label.pack(side='top')
self.main_frame.place(in_=self.master, anchor='c', relx=.5, rely=.5)
root = Tkinter.Tk()
app = Application(root)
app.mainloop()
If you use a GIF the image will be displayed, but using a PNG it will not. Again, this is only happening on OS X Mavericks, Mountain Lion works fine. I've tried re-installing (compiling PIL) with no luck, as well as trying a new virtualenv.
Is there perhaps some PNG attribute I need to set correctly when creating/saving the PNG? Or is this a bug in PIL or Tkinter or OS X?
Update to add some details
I'm using:
Python 2.7.5 (/usr/bin/python)
PIL 1.1.7 (compiled using pip)
This is on a machine that was just updated to Mavericks from Mountain Lion, and previously had PIL installed, and I haven't messed with the system Python shipped by Apple.
Update 2 Pillow setup summary
I installed Pillow 2.2.1 and it says it has PNG support:
--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version Pillow 2.2.1
platform darwin 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- TIFF G3/G4 (experimental) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
*** WEBP support not available
*** WEBPMUX support not available
--------------------------------------------------------------------
I also uninstalled and re-installed libpng using brew (libpng 1.5.14). I then re-installed Pillow to make sure it built with it, though I think it uses zlib.
Update 3 trying to build Python 2.7.5
Perhaps the issue is with zlib, trying to compile Python 2.7.5 I get this:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb _sqlite3 _ssl
bsddb185 dbm dl
gdbm imageop linuxaudiodev
nis ossaudiodev readline
spwd sunaudiodev zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
Failed to build these modules:
_tkinter
I think your problem is that your PIL was built without PNG support, or with only partial PNG support, on your Mavericks machine.
If PIL can't find both libpng and libz where it wants to, you won't have complete PNG support. And after upgrading from Mountain Lion to Mavericks, this seems to sometimes be a problem.
This may not be the same problem you're having. For example, it could be down to Apple using a buggy version of Tcl/Tk again (as they infamously did in Snow Leopard). But it's definitely worth trying.
With Pillow, and some versions of old-school PIL (but really, if you're not using Pillow, you almost definitely should be), the end of the install process gives you a friendly "PIL SETUP SUMMARY" section that shows you all the important configuration stuff.
I had the exact same problem with Pillow 2.2.1 on a locally-built Python 3.3.2. I solved it by using Homebrew to install libpng, then rebuilding Pillow:
$ brew install libpng
$ pip-3.3 uninstall pillow
$ pip-3.3 install pillow
I was experiencing the same problem and I did the following. It seems to be fixed.
sudo unistall pillow
xcode-select --install
pip install pillow
It seems to be working great. I also installed all the items below, but it seems you have it already installed
brew install libtiff libjpeg libpng webp littlecms
Did you install Pillow dependencies?
pip uninstall Pillow
brew install libtiff libjpeg webp littlecms
pip install Pillow
You will need HomeBrew to execute the brew command.
I installed Pillow from homebrew (brew install Pillow), all necessary dependencies will be installed automatically. Problem solved.

PIL: selftest fails, but package shows status is fine?

I have PIL installed with the required libraries (so I think). During installation it shows
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
--- LITTLECMS support available
However, when I run selftest.py, I get this:
*** PIL CORE support not installed
*** TKINTER support not installed
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not installed
*** LITTLECMS support not installed
i.e. it's not detecting PIL CORE, FREETYPE2 and LITTLECMS.
I installed the following packages on CentOS 6.0 using python 2.6.5
libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-devel
PIL was installed with pip install PIL. However, the selftest was run from a source code from the offical PIL website.
Any ideas?
Try building the C extensions in-place in the source directory with setup.py build_ext -i before running selftest.py or Tests\run.py.

Categories

Resources