| Reference | Downloads | Github

ImportError: No module named Image with Psychopy

Hi all,

Whenever I try to run some Python Package which uses Psychopy module, I am getting the following error.
I am using Python 2.7 and Mac OS Sierra.

Traceback (most recent call last):
  File "", line 8, in <module>
    from psychopy.visual import Window, Circle, ImageStim
  File "/Users/divz/anaconda/lib/python2.7/site-packages/psychopy/visual/", line 17, in <module>
    from .window import Window, getMsPerFrame, openWindows
  File "/Users/divz/anaconda/lib/python2.7/site-packages/psychopy/visual/", line 64, in <module>
    from .text import TextStim
  File "/Users/divz/anaconda/lib/python2.7/site-packages/psychopy/visual/", line 30, in <module>
    from psychopy.visual.basevisual import BaseVisualStim, ColorMixin
  File "/Users/divz/anaconda/lib/python2.7/site-packages/psychopy/visual/", line 20, in <module>
    import Image
ImportError: No module named Image

Please help me figure out why I am getting this error. Is it related to installing anaconda?

Probably wise to import the entire psychopy.visual library, as you may be missing a few imports by doing it piecemeal:

from psychopy import visual

Does that help?


I have tried that. It doesn’t help. Still the same error is displayed. It happens with every package that I run through Python which uses Psychopy.

OK. Image comes from the 3rd party library PIL (Python imaging library). Do you have that installed? i.e. it would be bundled with the standalone version of PsychoPy, but since you are running PsychoPy under your own Python (Anaconda), you’ll need to install that dependency yourself.

I have already PIL installed. But when I searched now, I have both PIL and Pillow. Does that create a problem? Should I uninstall any one of those?

I am able to solve Image import error by uninstalling PIL and Pillow and again installing Pillow. But now I am facing this issue.
Could you please take a look and let me know why this error is caused?

Traceback (most recent call last):
  File "", line 8, in <module>
    from psychopy import Window
ImportError: cannot import name Window

Thanks In Advance !

You had that right in your first code snippet above: Window is found in psychopy.visual, not psychopy.

Thanks Michael for your help.! I understood it now.