How may i install the Python Imaging Library to django environment? - django

I am currently finding it hard to install PIL on precise pangolin.
I have followed this tutorial (http://www.sandersnewmedia.com/why/2012/04/16/installing-pil-virtualenv-ubuntu-1204-precise-pangolin/)
When I do:
pip install PIL
I get the error:
Could not find any downloads that satisfy the requirement PIL
No distributions at all found for PIL
Looked around google but to no avail.

Try this:
pip install PIL --allow-external PIL --allow-unverified PIL

You can use Pillow
--> pip install Pillow

Related

Cannot install pillow on Windows

I keep getting errors when I try to run pillow on x64 Windows
I have followed these instructions for installing pillow
I seem to able to
import PIL
but it fails when I try
from PIL import image
See screen shot
Can someone please help?
I've tried installing the 32 bit version, but that fails and trying to uninstall pillow also fails
Solved
All I needed to do was
pip install pillow
That simple

Kivy cannot find PIL module in Mac

OSX 10.10.2, Python 2.7.9, Kivy 1.9
I used sudo pip install Pillow to install Pillow when i get the not found error. I can find PIL in python help('modules') but not in kivy help('modules')
I tried Kivy user group but got no reply yet. Thank you in advance!
Kivy 1.9 package uses it's own Virtual Environment. You have to make sure to install modules into that. Simply do::
kivy -m pip install pillow
Probably kivy is looking for the Pillow package in the wrong place.
You should check where your library is installed and use that path.
The path should be something like "/Library/Python/2.7/site-packages/", look if you have the PIL package in that position.
Then set the PYTHONPATH variable or use
import sys
sys.path.append('path_to_the_PILLOW_package')
and look if "import PIL" raises an ImportError.

Django: determine actually used pip packages

I got a Django project that was started without virtualenv. Now migrating to virtualenv and my requirements.txt created before is huge and not installable in the virtualenv (many errors as shown below). How can i generate a minimal list of required packages? Or is there some reference anywhere?
Could not find any downloads that satisfy the requirement PIL==1.1.7 (from -r requirements.txt (line 8))
Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL==1.1.7 (from -r requirements.txt (line 8))
it's not only PIL that throws errors, if I comment it another package shows and i can't know what's really used for my application to work.
Thanks in advance!
You can run pip freeze (related to system python used before virtualenv), this give you list of installed packages;
Then filter that list using following:
1) INSTALLED_APPS in settings
2) also check all from and import statement (search through the project)
I've had the same problem and there are issues getting PIL to install using PIP as there's no PIL 1.7 in the default Python repos.
The easiest fix is this to add these options to the pip:
--allow-external PIL --allow-unverified PIL
For example:
pip install -r requirements.txt --allow-external PIL --allow-unverified PIL
The problem with this it is a potential security issue and you don't want to do this on a production server! :)
Your options are to use Pillow which is a fork of PIL:
https://pypi.python.org/pypi/Pillow
Comments from the Pillow author, and you should verify that it works with you code.
Or try PIL 1.1.6 which is the Python Repos:
https://pypi.python.org/pypi/PIL
Or create your own repo and include the PIL 1.1.7 sources.
Or, if your on a Linux system install PIL using your distro's package management tool and remove PIL from your requirements file, and then rebuild your virutalenv.
You can this on Debian based distros like this:
sudo apt-get install python-imaging
Red Hat distros like this:
sudo yum install python-imaging

IOError decoder zip not available

I'm trying to get up and running with sorl thumbnail but I'm getting an error "decoder zip not available".
I have read through a ton of similar pages saying that it is a PIL / Pilow issue.
I have tried re-installing pil via:
easy_install http://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz
As well as:
pip uninstall PIL Pillow
pip install Pillow
pip install PIL
I read that Ubuntu uses a directory called /lib/x86_64-linux-gnu for x64 architectures. If you are using that architecture you need to create a symbolic link for that as well as for other shared libraries.
$ sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /lib/libz.so
Additional info:
OS: Ubuntu Precice
I have not tried installing the package zlib from source which some others have also mentioned worked for them.
I found two solutions for this that worked for me.
The first way that worked for me was to use a different imaging library all together. I installed pgmagic and that worked fine.
sudo apt-get install libgraphicsmagick++-dev
sudo apt-get install libboost-python1.40-dev
There is also other imaging libraries available and they are all listed in the sorl-thumbnail docs:
http://sorl-thumbnail.readthedocs.org/en/latest/requirements.html
The second way that worked for me (preferred) was literally a fresh install of everything where I removed both pillow and PIL and the re-installed them starting with pillow.
pip uninstall pillow
pip uninstall PIL
pip install pillow
pip install PIL

install pil on virtualenv with libjpeg

Currently I'm installing PIL into my virtual env as follows:
pip install -E . -r ./releases/%s/requirements.txt
where requirements.txt contains:
pil
I can upload png images but not jpeg images currently. From reading on the web it seems i may need libjpeg decoder? Am i installing pil incorrectly? What is the proper way to install pil for django in a virtual env with libjpeg?
You should install the libraries that others recommended but most importantly you should tell PIL where to find them. Edit the setup.py so that
JPEG_ROOT = None
becomes
JPEG_ROOT = libinclude("/usr/lib")
I found that the easiest way was to download the source with pip but not install:
pip install --no-install PIL
edit the setup (inside the build directory of the virtual environment) and the install
pip install PIL
you can find some more information in my blog
You can also try pillow which seems to do great job with little hassle (pip install pillow)
On Ubuntu precise, PIL doesn't find the jpeg library files, even once they are installed. The easiest way to fix this is to make a symlink after you have installed the jpeg dev package.
So, I needed an extra step:
pip uninstall PIL
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
pip install PIL
For Ubuntu 11.04, what finally worked for me is:
pip uninstall PIL
sudo apt-get install libjpeg8-dev
pip install PIL
The Python Imaging Library (PIL) seems really picky about version and location of the jpeg libraries. And because PIL is written in C and compiled, you need the development versions of the library in addition to the runtime versions.
The situation is so bad the community forked PIL to create a softer version: Pillow:
http://pypi.python.org/pypi/Pillow#why-a-fork
On OSX, I used the following binary to get libpng and libjpeg simultaneously installed systemwide:
libpng & libjpeg for OSX
Because I already had PIL installed (via pip on a virtualenv), I ran:
pip uninstall PIL
pip install PIL --upgrade
This resolved the decoder JPEG not available error for me.
You must install the libraries:
sudo aptitude install libjpeg62 libjpeg62-dev zlib1g-dev
if pip raises an error, try
easy_install PIL