TL;DR
This guide will teach you how to install PyGaze and its dependencies on Linux; specifically Debian 8, but it is highly compatible with other Linux distributions too. It is also available to download as a PDF.
Table of Contents
1 Introduction
General information is available at http://www.pygaze.org/.
- Operating System for these instructions: GNU/Linux Debian 8 “Jessie”
- Note that these instruction will likely work on any Debian derivative (Linux Mint, Ubuntu, etc.).
- I assume here that the user is comfortable with basic terminal commands (cd, cp, etc.) and is somewhat familiar with the directory system of GNU/Linux.
- Python 2.7.9 is pre-installed
2 Prerequisites
For more information on Python prerequisites, see http://www.pygaze.org/installation/.
2.1 Free Software
Type the following into the terminal. This will install (in order): NumPy, SciPy, Matplotlib, PIL, PyGame, PsychoPy, and pyglet:
sudo apt-get install python-numpy python-scipy python-matplotlib python-imaging python-pygame psychopy python-pyglet
2.2 Non-Free/Restricted Software
The instructions on the PyGaze website provide information about three additional programs, all of which are non-free or restricted software. In Shravan Vasishth‘s Eyetracking Lab they are using an Eyelink 1000 (1000Hz) eyetracker manufactured by SR Research (desktop mount camera system). They do not use SMI or Tobii eye-trackers. For this reason I will only install pylink here.
- pylink: proprietary library created by SR Research, requires registering with the SR Research support forum; see Section 2.2.1 below. Once registered, you can download and install pylink; see Section 2.2.2 below.
- PyViewX API: for communication with eye trackers manufactured by SensoMotoric Instruments (SMI), must request a download, provide some personal details, and wait for an e-mail with a download link.
- Tobii: for Tobii eye trackers via Tobii’s own Python bindings, based on Hiroyuki Sogo’s (Ehime University) script.
2.2.1 Registering For SR Research Support Forum
In order to download pylink, you have to register with the SR Research support at this link https://www.sr-support.com/forum.php. You are required to provide the following information:
- a user name and password
- email address
- institute, location, EyeLink system
You must accept the rules for the forum. After registering you will be sent a confirmation email. Open the link in your browser and then wait for approval of your account.
2.2.2 Installing pylink
After registering with SR Research support forum, log in so you may download the tar.gz file from here: https://www.sr-support.com/attachment.php?attachmentid=1106&d=1295295193.
Go to the directory where the download was saved (for me, cd ~/Downloads/) and unpack the tar.gz in the terminal with this command:
tar -xvzf pylink4python2.7_linux_x32.tar.gz
Go into the unpacked folder “pylink4python2.7″:
cd pylink4python2.7
Here you can copy the folder pylink2.7 to the folder /usr/lib/pymodules/
renaming it to pylink in the process:
sudo cp -r pylink2.7 /usr/lib/pymodules/pylink
3 PyGaze Installation
For more information on PyGaze installation, see http://www.pygaze.org/downloads/.
3.1 Site-Packages Directory
Installing PyGaze requires copying the PyGaze directory into Python’s site-packages directory. First check where this directory is located. One way to do this is with Python. In the terminal, type:
python
To check the site-packages directory, type the following in the Python console:
import site; site.getsitepackages()
This will list your site-packages directory. One of the directories I see listed is:
/usr/local/lib/python2.7/dist-packages/
Remember this path. Exit the Python console by typing:
quit()
3.2 Install PyGaze
In order to install PyGaze, download the zip file from here: http://www.pygaze.org/downloads/. Go to the directory where the download was saved (for me, cd ~/Downloads/). To unzip PyGaze, in the terminal type:
unzip pygaze.zip
To copy the unzipped PyGaze directory into the site-packages directory, type the following in your terminal (of course, you should use the site-packages directory you got from above):
sudo cp -r pygaze /usr/local/lib/python2.7/dist-packages/
Set the permissions to drwxr-sr-x:
sudo chmod 2755 -R /usr/local/lib/python2.7/dist-packages/pygaze/
3.3 Testing
Test if successful. Type python
into the terminal and in the Python console type: import pygaze
If you do not get an error message, you have successfully installed PyGaze.
4 Getting Started With PyGaze
There are several example experiments located by default in the directory pygaze/examples/. The PyGaze developers also provide many examples on their website. One that they recommend to start with is the “Simple Tracker Experiment”, which can be downloaded here: http://www.pygaze.org/resources/examples/simple_tracker_experiment.zip.
Unzip, enter the unzipped directory, and let the fun begin by typing python simple_tracker_experiment.py
in the terminal.
4.1 Potential Problems
When first running simple_tracker_experiment.py I encountered the following error:
pygame.error: No video mode large enough for 1920x1080
This is because pygame is trying to use the wrong screen size for my laptop. I was able to fix this by changing the screen size in constants.py (located in the same directory as simple_tracker_experiment.py) to my screen size (1600, 900) at the following line:
DISPSIZE = (1600,900) # canvas size
5 PyGaze Community
5.1 Forum
Be in touch with other PyGaze users at the forum: http://forum.cogsci.nl/index.php?p=/categories/pygaze. This is a great place to get help from the larger scientific community as well as to help others when you can.
5.2 Share Your Experiments
If you write some great experiments, PyGaze encourages you to share them with the scientific community via their website. To do so you should contact them via their contact form here: http://www.pygaze.org/contact/#contactform.