Eyetribe compatibility

Hi everyone,
I have an eyetribe eyetracker which I want to integrate into an existing experiment built using psychopy 2020.1.3. I’ve checked:

  1. ioHub with Eye Tribe eye-trackers
  2. https://stackoverflow.com/questions/25121166/incorporate-eye-tribe-eye-tracker-into-psychopy
  3. Starting eye tracker through iohub
  4. https://www.psychopy.org/api/iohub/starting.html
    But I didn’t manage to get it work.

Given that documentation for the integration of eyetribe with recent versions of psychopy is obsolete, I wanted to ask if there is any workaround available or if it’s no longer supported.

Hi Chris,

Funnily enough, before I started at PsychoPy, when I was a technician at Lincoln uni, I actually wrote some code to do just this!

Hi @TParsons. Thanks for your prompt reply and welcome to the psychopy community.
This tool is so useful. Thanks a lot for sharing.
I followed the instructions mentioned on the word document (btw thisExp.addData(‘etData’, val) throws an error because it has an apostrophe) but the issue now is that when it tries to read the eyetribe.py it doesn’t recognize the first line

pip install -r requirements.txt

I tried to find this txt file but to no avail. Even if I delete this line, then I get an error for the shapely package. (ModuleNotFoundError: No module named ‘shapely’). I installed it manually (either by using “pip install shapely” or downloading the package and install it from its folder path “pip install path of the folder” but again it shows the same error. When I run the eyetribe.py script from spyder it works smoothly without errors (without the pip install -r requirements.txt line) but from the psychopy environment it gives this error.
Any help would be very much appreciated.

UPDATE: I also deleted everything python-related (anaconda, python, psychopy etc) from my PC,in order to rule out the possibility of getting this error because of dependencies. Then, I downloaded python 3.6.6, installed Psychopy from the command line (“pip install psychopy”) but again I get the error about the requirements.txt file and if i delete it, the shapely error comes up again.

@TParsons maybe the .txt file is missing from the git repo? On which psychopy version you tested this tool?

Without access to an EyeTribe it’s difficult to test it, but you’re right that requirements.txt was missing from the repo! My oversight with the .git-ignore (most of the time we’d give this to students using a OneDrive link or memory stick so I’d never noticed it was missing on GitHub). Without Shapely, it can’t construct the polygons it uses to test whether fixations fall within an ROI, which is why it only errors out some of the time.

When you install Shapely manually, where are you installing it to? The best solution is probably to add that location to the PsychoPy path, via Preferences -> General -> path, so that it can see and import Shapely, then you can remove the pip install command.

I’ve just pushed out a commit to the repo with updated instructions, code and a requirements.txt file, hopefully that should sort it out!

I’m trying to use your system integration with TheEyeTribe eye tracker, but I’m having difficulty with Shapely. I’ve tried everything, but PsychoPy can’t find it.

The error:
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
Hello from the pygame community. Contribute - pygame wiki
File “C:\Users\User\Desktop\xxx\teste.py”, line 6, in
import eyetribe as et
File “C:\Users\User\Desktop\xxx\eyetribe.py”, line 6, in
from shapely.geometry import Point, Polygon
ModuleNotFoundError: No module named ‘shapely’

→ I installed shapely right I swear.

It could be that shapely installed to the wrong Python environment - how did you install it? Via command line? (python -m pip install shapely?)

Yes, I’m installing via command line.

If you do the following in the command line, what does it return?

python
import sys
print(sys.executable)

If it’s a path outside of the “Program Files/PsychoPy” folder then you’ll need to install again but using the location of “python.exe” in the PsychoPy folder rather than the system Python