| Reference | Downloads | Github

Psychopy and Pupil labs eye tracker



Hello All,

Has anyone tried to integrate pupil labs eye tracker into Psychopy?
I am new to research and programming. I have developed my experiment mainly through the builder interface of psychopy, I am now trying to synchronize timing between the 2 and I am struggling!!! The code for the stroop task is for the tobi eye tracker. I have also tried to implement the LSL protocol through one of the plugin available but no success as I am not sure how to receive the data.

I would appreciate any hints or help (baby language please :).

Thank you so much!



Hi elodie_rigal:
I’m running an experiment in psychopy wich involves pupil lab eye-tracker. Do you already know how to integrate them and synchronize timing ?
It would be very helpfull for me if you reply with a soluton, if you found one.
thanks you so much in advance!


Hello Pablo,

It’s been now a few months since I did this experiment. I used the code that you can find on Pupil Lab website but I ran the code on a separate python program (not directly from Psychopy) and was receiving the data on a separate port.
Here what I used to record the ‘gaze’.

Hope this helps.

import zmq
from msgpack import loads

context = zmq.Context()
# open a req port to talk to pupil
addr = ''  # remote ip or localhost
req_port = "50020"  # same as in the pupil remote gui
req = context.socket(zmq.REQ)
req.connect("tcp://{}:{}".format(addr, req_port))
# ask for the sub port
sub_port = req.recv_string()

# open a sub port to listen to pupil
sub = context.socket(zmq.SUB)
sub.connect("tcp://{}:{}".format(addr, sub_port))

# set subscriptions to topics
# recv just pupil/gaze/notifications
sub.setsockopt(zmq.SUBSCRIBE, 'pupil.')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'gaze')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'notify.')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'logging.')
# or everything:
# sub.setsockopt_string(zmq.SUBSCRIBE, '')

    except KeyboardInterrupt:


Hi @Elodie_Rigal1
I’m trying to do the same thing. I have an experimentation that I created on psychopy and my participants will have eye tracking device. If you have time, can you explain to me more in details how to link psychopy and pupils. Is it on the same computer that you have both the experimentation and the eye tracking, or you work on two computers?
Thanks a lot for your help


Hello Elodie,

Do you have a paper or working paper related with this research?
I planning to run my economic experiments using Pupil Labs eye-trackers. So, I really need some guidance on how to conduct my research.

Thank you,