I get this error when I try to run my program.

Traceback (most recent call last): File "green.py", line 11, in from PIL import Image ImportError: No module named PIL

I already tried "pip install PIL" and "sudo pip install PIL" which give me the error: Could not find a version that satisfies the requirement PIL (from versions: ) No matching distribution found for PIL


The module that you need is pillow.

Depending on the Python version for which you want to install it and the version of pip, one of the following will work:

pip install pillow

pip3 install pillow

After that, you can import PIL

To give an explanation of why pillow is needed and not PIL, the former is a fork of the latter. The last release of PIL was in 2009 when it was forked off into Pillow. The acronym stands for Python Image Library and it is used for opening, manipulating, and saving image formats. It explains the Image ImportError in your question.

  • I had to lookup pillow to find out it is a fork of PIL. The answer could benefit from explaining what it is, and why it is needed. – Rui F Ribeiro Apr 17 at 7:40
  • 1
    @RuiFRibeiro So did I. I'll add the explanation later on today. – Nasir Riley Apr 17 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.