After installing OpenCV, we are now ready to install PyGaze.

First of all, let's install all dependencies (some depencies may have been already installed, but let's stay on the safe side)

In a terminal window , type

 

sudo apt-get install python-numpy python-scipy python-matplotlib python-imaging python-pygame psychopy python-pyglet

 

This will install (in order): NumPy, SciPy, Matplotlib, PIL, PyGame, PsychoPy, and pyglet:

 

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. To check which is the site-packages directory, type

 

python
>>> import site; site.getsitepackages()
/usr/local/lib/python2.7/dist-packages/
>>> quit()

 

In order to install PyGaze, download the latest version of pygaze from github

 

$ wget https://github.com/esdalmaijer/PyGaze/archive/master.zip

 

Go to the directory where the download was saved (for me, cd ~). 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/

To test if everything was right, I tried to import the pygaze package from a Python console

 

python
>>> import pygaze

 

As no errors were shown, everything worked perfectly

 

 

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 typingpython simple_tracker_experiment.pyin the terminal.