Iohub EyeLink fails to import pylink properly

Hello everyone,

I posted another issue here (Iohub EyeLink unresponsive keyboard during calibration), but I wanted to also document what happens if I simply run getting_started.py demo with a clean version of PsychoPy 1.84 on Mac OS 10.9 Mavericks.

Running: /Users/egor/Downloads/distribute/demos/coder/getting_started/getting_started.py

2016-09-06 13:08:41.498 python[91949:507] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/6k/qxj7wz1n5kbff7v1rdlvbkkr0000gv/T/org.psychopy.PsychoPy2.savedState
2016-09-06 13:08:44.569 python[91989:507] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/6k/qxj7wz1n5kbff7v1rdlvbkkr0000gv/T/org.psychopy.PsychoPy2.savedState
Could not add path: /Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/darwin/python27/
<type ‘exceptions.AttributeError’>
AttributeError(“‘module’ object has no attribute ‘EyeLink’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 193, in setConnectionState\n EyeTracker._eyelink=pylink.EyeLink(None)\n’]
** EyeLink Error: Could not connect to EyeLink Eye Tracker. EyeLink Eye tracker device will run in ‘dummy’ mode.
<type ‘exceptions.AttributeError’>
AttributeError(“‘module’ object has no attribute ‘EyeLink’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 193, in setConnectionState\n EyeTracker._eyelink=pylink.EyeLink(None)\n’]
EYELINK Error during _eyelinkSetScreenPhysicalData:
<type ‘exceptions.AttributeError’>
AttributeError(“‘NoneType’ object has no attribute ‘sendCommand’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 1249, in _eyelinkSetScreenPhysicalData\n eyelink.sendCommand(“screen_distance = %d “%(sdist['surface_center'],))\n’]
---- Error during EyeLink EyeTracker Initialization ----
<type ‘exceptions.AttributeError’>
AttributeError(”‘NoneType’ object has no attribute ‘sendCommand’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 85, in init\n self._eyelink.sendCommand(“aux_mouse_simulation = NO”)\n’]
---- Error during EyeLink EyeTracker Initialization ----
Could not add path: /Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/darwin/python27/
Starting Data Collection. Press SPACE key to stop…
<type ‘exceptions.AttributeError’>
AttributeError(“‘module’ object has no attribute ‘EyeLinkCustomDisplay’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 322, in runSetupProcedure\n import eyeLinkCoreGraphicsIOHubPsychopy\n’,
’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyeLinkCoreGraphicsIOHubPsychopy.py”, line 225, in \n class EyeLinkCoreGraphicsIOHubPsychopy(pylink.EyeLinkCustomDisplay):\n’]
<type ‘exceptions.AttributeError’>
AttributeError(“‘NoneType’ object has no attribute ‘isRecording’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 363, in isRecordingEnabled\n return self._eyelink.isRecording() == 0\n’]
<type ‘exceptions.AttributeError’>
AttributeError(“‘NoneType’ object has no attribute ‘startRecording’”,)
[’ File “/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/eyetracker.py”, line 395, in setRecordingState\n error = self._eyelink.startRecording(1,1,1,1)\n’]

Note that if I add the path to SR version of pylink to PsychoPy standalone paths, it still fails to import properly:

sys.path.append('/Library/Python/2.7/site-packages/pylink/')
print dir(pylink)

################ Running: /Users/egor/Documents/test_pylink.py #################
[‘GSMLink’, ‘LOGGER’, ‘SerialLink’, ‘TCPLink’, ‘UDPLink’, ‘VERSION’, ‘builtins’, ‘doc’, ‘file’, ‘name’, ‘package’, ‘path’, ‘version’, ‘active_logger’, ‘compat’, ‘link’, ‘link_from_url’, ‘logger’]

I’m working on getting an Eyelink 1000 system running through psychopy and encountered the same path problem when running a couple of the iohub demos (I don’t have one called getting_started.py). It seems to be trying to import pylink from a specific folder that doesn’t exist. The “import pylink” statement still works, but it imports the wrong pylink library (it’s importing this pylink https://pypi.python.org/pypi/PyLink instead of the SRR one), so the import doesn’t fail but all the following code that is supposed to instantiate an eyelink object fails, hence all the attribute errors.

I tried making a “darwin” folder inside that eyelink folder, and then copying in the pylink library I downloaded from SR Research, but it didn’t fix the problem.

I nosed around in the rest of the packages that come with Psychopy standalone, and it comes with a pylink folder, but it’s the other pylink (https://pypi.python.org/pypi/PyLink), not the SRR pylink. I searched through all the psychopy code and nothing calls pylink besides iohub eyetracker, so I moved that pylink folder (/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/pylink) out of the way and copied in the one I’d downloaded from SRR and now I can get the demos/iohub/eyetracker/selectTracker/run.py to work! I’m not sure why the file-IO pylink is included in Psychopy Standalone.

I’m on a Mac running 10.8.4 using a fresh install of Psychopy Standalone 1.84.

Dear Andrea,

I moved that pylink folder
(/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/pylink)
out of the way and copied in the one I’d downloaded from SRR

I should have mentioned that I’ve tried doing that. This actually got my code to work, but demos simply crashed, without giving the same error. So it’s more of a bug report, as the default configuration in iohub does not seem to work.

The inclusion of the wrong pylink library was my error when I had to do a complete rebuild of my Python installation (from which the Standalone distributions are built). I erroneously thought when pip install pylink succeeded that SRR had started releasing on PYPI but apparently not. I’m discussing with them doing so to prevent this happening again:
https://www.sr-support.com/showthread.php?5351-pylink-update-on-pypi&highlight=psychopy

I’ll be building a new standalone shortly with the correct pylink libs included

I’m afraid I don’t have any leads on the subsequent crash @egorananyev

1 Like

Release 1.84.2 and the standalone includes the correct pylink lib now I believe.

Hi

I am experiencing the same issue using the 1.84.2 standalone version on windows 7.

ioHub Server Process Completed With Code:  0
<type 'exceptions.AttributeError'>
AttributeError("'module' object has no attribute 'getEyeLink'",)
['  File "C:\\Program Files (x86)\\PsychoPy2\\lib\\site-packages\\psychopy-1.84.2-py2.7.egg\\psychopy\\iohub\\devices\\eyetracker\\hw\\sr_research\\eyelink\\eyetracker.py", line 1508, in _getCalibrationMessage\n    m=pylink.getEyeLink().getCalibrationMessage()\n']

Are you sure it has been corrected?

Did you install the 1.84.2 standalone or did you install the previous standalone and then upgrade it?

Hi Andre,

I’m having the same problem on my Ubuntu 17.04 and PsychoPy 1.84.02. i registered at the SRR forum and they have several pylink tar’s (https://www.sr-support.com/forum/downloads/eyelink-display-software/44-pylink?t=14), which one did you exactly use? They have some instructions for system-wide installation of the most recent software (the whole thing, not only pylink), but I want only pylink since I use it in a virtual envrionment. I tried with pylink4python2.7_linux_x64.tar.gz, but when trying to import pylink it complains with “ImportError: libeyelink_core-1.9.so.58: cannot open shared object file: No such file or directory”.

Thanks!

Hi Jon,

I went through the post but it seems they are still not providing pylink in PyPi, in your new build are pylink ofr linux included? at psychopy/psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/ is see only win32 folder, or I am not looking at the correct spot?

Hrvoje

I used the pylink for the system I’m on (python 2.7, Mac OSX). I don’t know about pylink on linux, so I don’t know about the error you are getting.