Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Pygaze example doesn't work.

edited September 2015 in PyGaze


I'm really interested in Pygaze, and try to use it in my eyelink studies.
Already installed all requirements in my Mac (OS Marvericks), according to the instructions.
I use Python 2.7.10, Eyelink1000plus.

"" didn't run, when I tried to confirm that operation.
The error was below.

Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygaze/examples/simple_tracker_experiment/", line 20, in
tracker = eyetracker.EyeTracker(disp)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygaze/", line 56, in init
from libeyelink import libeyelink
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygaze/", line 37, in
import Image
ImportError: No module named Image
Process finished with exit code 1

What should I do?

Sorry for my beginner skill, but I appreciate for your help.


  • edited 7:04PM


    No Mac user here, so here are just some guesses.
    Did you select the Eyelink in the pygaze_init module? ("select tracker type" is on "simple dummy" by default). If it still doesn't work when set to Eyelink, you can also try to set it to "advanced dummy" (where your mouse substitutes for the eyetracker input). If that works, then at least you can be sure the problem is due to the eyetracker setup.



  • edited 7:04PM

    Hi guys,

    I think @Josh misunderstood the question a bit, as he is referring to the OpenSesame plug-in. From your question, I seem to make out you are trying to run an example Python script, correct?

    To be honest, Mac is always a bit of an issue. I have little experience with the platform, and although I'm used to Linux (which is also UNIX), sometimes the two correspond way too little for me to make any kind of intelligent argument. That said, let's try to get you sorted.

    The traceback you posted indicates that the error occurs when PyGaze tries to import Image, which is the Python Image Library (or PIL, for short). It could well be you forgot to install this, as it is only one of the many dependencies.

    On the PyGaze website's installation page, there's a link to one PIL installer, that seems to have last been updated for Python 2.5. Note that this might not work on Python 2.7.

    Alternatively, you could download and install the source package by following the instructions on good ol' StackOverflow. This requires you to open a Terminal, and run the following commands:

    # download
    curl -O -L
    # extract
    tar -xzf Imaging-1.1.7.tar.gz
    cd Imaging-1.1.7
    # build and install
    python build
    sudo python install
    # or install it for just you without requiring admin permissions:
    # python install --user

    After doing this, running the example shouldn't give you the same error, because Imaging can then be imported. There might be further issues, though! For example, are you aware that you're trying to run the example script with an EyeLink attached? (It's not set to dummy mode.) This is fine, as long as you've installed the EyeLink software, including the pylink Python library.

    Good luck with the process! (And sorry it's such a hassle to install: welcome to Python on Mac...)


  • rrrrrr
    edited 7:04PM

    Thank you for your prompt reply.

    As I said, I already installed PIL.
    To confirm it, when I re-tried to install it (this install way is by Macports), the Terminal said below.

    $ sudo port install py27-pil
    ---> Computing dependencies for py27-pil
    ---> Activating py27-pil @1.1.7_7
    Error: org.macports.activate for port py27-pil returned: Image error: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ already exists and does not belong to a registered port. Unable to activate port py27-pil. Use 'port -f activate py27-pil' to force the activation.
    Please see the log file for port py27-pil for details:
    To report a bug, follow the instructions in the guide:
    Error: Processing of port py27-pil failed

    You can see PIL already exists.

    Other library which I use for my experiment and image processing using PIL works well.

    Sorry to bother you, but I appreciate for your help.

  • rrrrrr
    edited 7:04PM


    I modified my " ImportError: No module named Image " by forcing activation of PIL according to error messages on terminal.

    However, another error happened as below.

    Traceback (most recent call last):
    File "/Users/ryotachibana/Desktop/PyGaze-master/examples/simple_tracker_experiment/", line 25, in
    tracker = eyetracker.EyeTracker(disp)
    "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygaze/", line 56, in init
    from libeyelink import libeyelink
    "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygaze/", line 38, in
    custom_display = pylink.EyeLinkCustomDisplay
    AttributeError: 'module' object has no attribute 'EyeLinkCustomDisplay'
    Process finished with exit code 1

    How do I correct it?

  • rrrrrr
    edited September 2015


    Thank you for your advise.
    I have good news.

    I succeeded to use Pygaze in Mac.

    I found that we should install the EyeLink Developer's Kit (
    This will be installed in '/Application/'.

    We can chose the suitable version of pylink for our Python (e.g. pylink2.7) from '/Application/Eyelink/pylink/'.
    After the choice, we should copy it to the directory we usually use (in my case, opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7).
    Don't forget to rename it from 'pylink2.7' to 'pylink', and create the path between your Python and the directory includes pylink.

    This works well!

    I hope for your information.

  • edited 7:04PM

    This is great news, thanks for sharing your solution!

Sign In or Register to comment.