0

I want to use the ImageField in Django and I was told to install Pillow rather than PIL. I installed Pillow by doing this

pip install Pillow

and then when I ran the server, it said

To use ImageFields, you need to install PIL

but I was told it should work with just having Pillow. I did further research and I read that I should try

pip install Pillow-PIL

and I tried that and it still have the same error. I tried import it in models.py like this:

from PIL import Image

but then it gave an error saying 'No module named PIL'. What am I doing wrong? On another SO post, a user said

Did you install Pillow into your system site-packages? or into a virtualenv's site-packages?

How do I confirm that Pillow is installed into my system site-packages?

Note: I am using Django 1.5, Python 2.7 and not using virtualenv.

SilentDev
  • 20,997
  • 28
  • 111
  • 214

1 Answers1

1

First to check whether any package is installed use:

pip freeze

libjpeg-dev is required for PIL to process jpeg format. Use the following link for any other PIL errors: https://stackoverflow.com/a/10109941/2323987

Community
  • 1
  • 1
Arun Reddy
  • 3,443
  • 1
  • 21
  • 16
  • Also make sure you activated the venv in which you installed the package. – Arun Reddy Feb 22 '14 at 03:47
  • okay I did pip freeze and I have edited my post to show what came up. There is no Pillow or PIL, how come? And how do I 'activate the venv which I installed the package in'? I've never used venv before, I just did the 'pip install' commands in the 'downloads' directory. Do I need to syncdb again after doing the pip installations? – user2817200 Feb 22 '14 at 04:46
  • Did you activate the virtual env before doing pip freeze? Command: source venvname/bin/activate – Arun Reddy Feb 22 '14 at 04:49
  • I don't have a venv, I wouldn't know what my 'venvname' is.. is there a way for me to 'create' one? I started working on the project and never did anything regarding venv before so i'm not too sure how it's done. How do I get the venv name? – user2817200 Feb 22 '14 at 04:52
  • @Trickster whoops sorry, I was posting with a different account but user2817200 is me. I just realized I'm signed in with a different account on my host OS, I normally post using my VM but the last two posts were from the host OS and I wasn't aware that it was a different account. Anyways, how do I create a venv / find out the venv name? – SilentDev Feb 22 '14 at 04:58
  • I suggest you to read about python virtual environments . It will be very useful in future. So, for try reinstalling it...command for uninstall: pip uninstall package. Follow the link I gave in the answer while reinstalling. – Arun Reddy Feb 22 '14 at 05:03