Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Python imaging library (PIL) on Ubuntu

Something that probably shouldn't be causing me so many problems, is.

I'm trying to install PIL on my Ubuntu server. It's installing fine. However every time I try and update the database to add the image field I get the following error:

Error: One or more models did not validate: product.product: "image": To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .

I've just realised I have been logged in as my user. Do i need to be logged in as root to install it? I'm doing this on a VPS not a local machine.

I've tried loads of tutorials on the web and not getting anywhere at all.

like image 743
JDavies Avatar asked Jul 16 '12 13:07

JDavies


People also ask

Is PIL included in Python?

PIL was discontinued in 2011 and only supports Python 2. To use its developers' own description, Pillow is the friendly PIL fork that kept the library alive and includes support for Python 3.

How do I know if Python PIL is installed?

Step 2: To check if PIL is successfully installed, open up the python terminal by typing python3 in the terminal. This will open up the python3 interactive console now type the following command to check the current version of the PIL. This will output the currently installed version of the PIL.

What is PIL image in Python?

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The Image module provides a class with the same name which is used to represent a PIL image.


2 Answers

I had to install python-dev then install PIL inside my virtualenv.

All working now.

Thanks for your help all! :)

like image 177
JDavies Avatar answered Sep 18 '22 20:09

JDavies


If you are not root, then entering the following command should install python-imaging:

sudo apt-get install python-imaging

Or (if you are root), the following command (without sudo) will install python-imaging

apt-get install python-imaging
like image 35
Igor Chubin Avatar answered Sep 18 '22 20:09

Igor Chubin