1

I am running Python 2.7.1.1 with Anaconda2 4.0.0 64-bit on a Windows 7 machine. I'm trying to install Pillow for imaging, and after having read through every thread I could find, I am still unable to reach a solution. I have installed and uninstalled Pillow through various means including:

pip install Pillow
conda install Pillow
easy_install Pillow

I've gone to the Anaconda site-packages list and, lo and behold, the package for Pillow-3.2.0-py2.7.egg-info exists.

I've tried importing the package through both:

import Image
from PIL import Image

But I encounter the following ImportError:

 from PIL import Image
 ImportError: No module named PIL

I've already uninstalled the original PIL library that I tried to install to ensure that only the Pillow package exists. Any help would be greatly appreciated!

DarthVarun
  • 11
  • 1
  • 2
  • 1
    Are there any errors shown during installation? – jbndlr Jul 06 '16 at 15:17
  • 2
    This is because you have 2 Python interpreters and you have to specify which one you're using. Provide the anaconda location has Pillow, and not the original interpreter. – dmitryro Jul 06 '16 at 15:17
  • No errors shown during installation that I am aware of. I can attach screenshots of the command line after installation if necessary. Could you expand on what you mean by 2 Python interpreters? As far as I know I only have Anaconda installed? – DarthVarun Jul 06 '16 at 15:19
  • No, you have 2 pythons now. So you have to verify which one is called – dmitryro Jul 06 '16 at 15:19
  • Unless you're not on linux and you can entirely uninstall the existing Python. Just installing a new Python interpreter does not mean you have the previous uninstalled or overwritten. – dmitryro Jul 06 '16 at 15:21
  • After checking my list of installed programs, I see now that I have both Python 2.7 AND Anaconda installed on my machine. After uninstalling the original Python, it works! Thank you so much! – DarthVarun Jul 06 '16 at 15:21

2 Answers2

0

It sounds like Anaconda isn't playing nice with your system due to the fact that you have two interpreters installed (Anaconda's and Python 2.7.1.1). I would remove everything (Python, Anaconda, etc) and either reinstall Anaconda fresh, or the get the newest version of Python from python.org (2.7.12).

Personally, I'd go for the Python 2.7.12 from python.org (I've always had issues with prepackaged distros like Anaconda).

If you go that route, after your environment is clean I would make sure Pip is all up to date (pip install pip --upgrade) and then install Pillow from whl file provided by the University of California Irvine.

To do that, just go here: http://www.lfd.uci.edu/~gohlke/pythonlibs/

Download the Pillow whl file for Windows 64bit. Make sure Python is set up in your path and then just go to the directory where you downloaded Pillow and enter the following (replacing the filename with the one you downloaded):

pip install pillowfile.whl

good luck, and happy coding!

Jaxian
  • 1,146
  • 7
  • 14
0

If you can't import a package into Python but it is definitely there in the site-packages folder, then you are more than likely running the wrong Python interpreter.

You can check this by running python from the command line and then entering:

import sys
sys.executable

That will return a string pointing to the current running Python interpreter.

Wrong Python

If that doesn't point to your Anaconda installation then you have a paths problem.

On windows you can set the PATH through My Computer / Properties / Advanced. Look at the Environment Variables and ensure that the Anaconda path string is before any other Python path (If the Anaconda path isn't there, then something is very messed up and you may want to simply re-install Anaconda).

Right Python

If the path returned by sys.executable is correct then the installation of Pillow must be broken somehow. You can try un-installing and then re-installing. As an absolute last-resort you could also try deleting the Pillow folder manually and re-installing it.

mfitzp
  • 15,275
  • 7
  • 50
  • 70