0

I'm trying to download and install pythons image library PIL or pillow. I've looked at this question (No module named Image) and this question (Can't install Python Imaging Library using pip) and although I seemed to be having the same problem none of the answers helped me.

I use a mac with OSX 10.11.4 and my python interpreter is versions 2.7.10

Here is what I have tried to do:

download the tar ball (Python Imaging Library 1.1.7 Source Kit from http://www.pythonware.com/products/pil/#pil117) and unzip (the result is a folder called Imaging-1.1.7). I have this folder in my downloads folder. I then ran this in the command line:

pip install pillow

and this is what I got back:

Requirement already satisfied (use --upgrade to upgrade): pillow in /usr/local/lib/python3.5/site-packages

I then tried to run this python script:

from PIL import Image

but I got this error:

python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import Image
ImportError: No module named Image

I am very confused, I have never been able to download and install any modules before because I have had similar problems, so if your help will be greatly appreciated as it will allow me to download other modulus too. thanks in advance

Thanks so far for the help but nothing suggested has worked. I tried to download python 3.5.1 from this site (https://www.python.org/downloads/) but when I run this command (python -V) in command line it still tells me I am using version 2.7.10

Also, I went into my applications folder to see if I had PIL and uninstall it if I did because it cannot coexist with pillow (according to one the answers so far) but I couldn't find it there. Am I looking in the wrong place or do I simply not have it?

Anyway, still haven't figured it out yet. It would be great if I could have some advice on downloading and installing stuff in general because, like I said before, I've never been able to download anything and have it actually work.

Community
  • 1
  • 1
Mathew
  • 1,116
  • 5
  • 27
  • 59
  • The message `Requirement already satisfied ... in /usr/local/lib/python3.5/site-packages` implies that your `pip` is associated with Python3.5. But you say your `python` is version 2.7. So It sounds like pip installed `pillow` for your python3.5 distribution but your `python2.7` does not have `pillow` installed. – unutbu Jun 07 '16 at 21:44
  • so if I updated my python interpreter to version 3.5 that might fix it? if so, how would I do that? – Mathew Jun 07 '16 at 21:55

2 Answers2

0

Python 2.7 and 3.3 have their own package locations. Since you have version 2.7 and 3.3 installed, you must do the following:

pip2 install pillow
Lonkey
  • 183
  • 10
  • I pasted that command exactly into commandline and got this: zsh: command not found: pip2.7 – Mathew Jun 07 '16 at 22:00
  • That's my fault. The correct command would be "pip2". Perhaps you should check out this [link](http://stackoverflow.com/questions/16129720/pip-install-for-both-pythons) to find out how to use both versions simultaneously. – Lonkey Jun 07 '16 at 22:09
  • is that "pip2" without the quotes becuase that is the same as what you wrote before – Mathew Jun 07 '16 at 22:16
  • or do you mean "pip2 pillow" instead of "pip2 install pillow" – Mathew Jun 07 '16 at 22:17
  • Without the quotes. First I have wirtten "pip2.7" but I edited my answer after I reread it and found that mistake. – Lonkey Jun 07 '16 at 22:21
  • this is what I got when I tried that:pip2 install pillow zsh: command not found: pip2 – Mathew Jun 07 '16 at 22:25
  • I have Imaging-1.1.7 in my downloads folder btw – Mathew Jun 07 '16 at 22:27
0

You have to use sudo, and specify which version of pip:

sudo pip2 install Pillow
or
sudo pip3 install Pillow

Also, did you read the documentation:

Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL.

You have a conflict in versions. And there's a difference between downloading a zip file and installing from pip.

I hope that helped.

Rich
  • 1,103
  • 1
  • 15
  • 36
  • This is what I got when I pasted your first suggestion into commandline sudo pip2 install Pillow Password: sudo: pip2: command not found – Mathew Jun 07 '16 at 22:02
  • Try installing pip2: `sudo apt-get install python-pip` – Rich Jun 07 '16 at 22:06
  • I've seen pip3, but my experience is that pip alone is appropriate for python 2.7. I've never seen pip2 – joel goldstick Jun 07 '16 at 22:10
  • Well it depends: If i try to install somthing with just pip, it gets installed for python3. If I want something installed for python2.7 I have to specify pip2. – Rich Jun 07 '16 at 22:14
  • @Rich doesn't work either, this is what I get: sudo apt-get install python-pip Password: sudo: apt-get: command not found – Mathew Jun 07 '16 at 22:18
  • You ran `sudo apt-get install python-pip` and it failed? Which types of python are on your computer? – Rich Jun 07 '16 at 22:27
  • Also, I think I should already have pip installed, according to google: *If you have Python 2 >=2.7.9 or Python 3 >=3.4 installed from python.org, you will already have pip and setuptools, but will need to upgrade to the latest version: ...* I have python 2.7.10 – Mathew Jun 07 '16 at 22:28
  • Running python -V gives me this response python -V Python 2.7.10 – Mathew Jun 07 '16 at 22:29
  • Wait, I just noticed you're on OSX. Hmm.. You aren't misspelling it, right? – Rich Jun 07 '16 at 22:39
  • miss spelling what? I posted exactly what I put in the commandline and what came out. copy and past, no spelling errors could have been made – Mathew Jun 07 '16 at 22:46