psychopy.org | Reference | Downloads | Github

ImportError: No Module named Image

It’s my first time trying to program something. I want to make a grating using GratingStim found in the visual module. When trying to import visual, following error comes up. Where can I find the module named Image?

from psychopy.visual import visual

Traceback (most recent call last):
  File "C:\Users\Family\workspace\HelloPython\src\com\View\OknGrid.py", line 6, in <module>
    from psychopy.visual import visual
  File "C:\Users\Family\workspace\HelloPython\src\com\View\Libraries\python-2.7.3\Lib\site-packages\psychopy\visual.py", line 20, in <module>
    from psychopy import core, platform_specific, logging, preferences, monitors, event
  File "C:\Users\Family\workspace\HelloPython\src\com\View\Libraries\python-2.7.3\Lib\site-packages\psychopy\event.py", line 12, in <module>
    import psychopy.core, psychopy.misc
  File "C:\Users\Family\workspace\HelloPython\src\com\View\Libraries\python-2.7.3\Lib\site-packages\psychopy\misc.py", line 13, in <module>
    import Image, cPickle
ImportError: No module named Image

I think you want to do

from psychopy import visual

instead.

I changed that but I still get the same ImportError message.

Weird. What version of PsychoPy is that? psychopy.misc imports without problems for me here. Thanks!

I think this is quite an old problem (that was fixed in 2013)

As Richard says, what version are you using (and can you upgrade?)

1 Like

I use psychopy version 1.75.01 and I cannot update as I am not sure that all other codes needed will still be working.

Wow, this is prehistoric indeed! I wonder if anyone would still be willing to voluntarily provide support for this version, unless you pay them…

So you would need to change the line that says import Image to read from PIL import Image but, as Richard points out, you’re pretty much on your own fixing further issues with a version this old