Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BF: Fix ioHub finding eyetracker #3 #5

Closed
wants to merge 2 commits into from

Conversation

TEParsons
Copy link
Collaborator

In conjunction with this PR to PsychoPy, these changes allow ioHub to find the eyetracker class and its associated YAML via its entry point into PsychoPy.

@TEParsons
Copy link
Collaborator Author

@domstoppable Could you pull down this branch along with the latest psychopy/dev branch and test whether ioHub can find and run the calibration routine for either/both of the eyetrackers? I believe it should now be able to with these changes along with the attached PR to PsychoPy

@domstoppable
Copy link
Collaborator

The experiment fails to run. Log file attached
last_app_load.log

@domstoppable
Copy link
Collaborator

@TEParsons - what needs to happen here?

@domstoppable
Copy link
Collaborator

@TEParsons - tested this against v2024.2.1 on Mac (standalone build, py3.10), and it's still broken.

To test, I cloned your fork, built a wheel, and then installed the wheel via Builder's gui. I initially ran into an error where numpy 2.x is installed and is incompatible:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/Users/dom/Desktop/test_lastrun.py", line 15, in <module>
    from psychopy import locale_setup
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/__init__.py", line 123, in <module>
    from psychopy.tools.versionchooser import useVersion, ensureMinimal
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/tools/versionchooser.py", line 19, in <module>
    from psychopy import logging, tools, web, constants, preferences, __version__
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/logging.py", line 43, in <module>
    from psychopy import clock
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/clock.py", line 298, in <module>
    monotonicClock = MonotonicClock()
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/clock.py", line 242, in __init__
    self._timeAtLastReset = getTime()
AttributeError: _ARRAY_API not found
Traceback (most recent call last):

To get around this, I added "numpy<2" to pyproject.toml on your fork, rebuilt the wheel, completely deleted ~/.psychopy3/, and installed the new wheel. That gets us passed the numpy error, but still fails:

Error during device creation ....
_addDeviceView: Error adding class. 
Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 723, in createNewMonitoredDevice
    dev_data = self.addDeviceToMonitor(dev_cls_name, dev_conf)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 849, in addDeviceToMonitor
    dev_mod = importDeviceModule(dev_mod_pth)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/devices/__init__.py", line 1007, in importDeviceModule
    raise ModuleNotFoundError(
ModuleNotFoundError: Could not find module `psychopy.iohub.devices.eyetracker.pupil_labs.neon`. Tried importing directly and iteratively using entry points.
Error during device creation ....
Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 723, in createNewMonitoredDevice
    dev_data = self.addDeviceToMonitor(dev_cls_name, dev_conf)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 849, in addDeviceToMonitor
    dev_mod = importDeviceModule(dev_mod_pth)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/devices/__init__.py", line 1007, in importDeviceModule
    raise ModuleNotFoundError(
ModuleNotFoundError: Could not find module `psychopy.iohub.devices.eyetracker.pupil_labs.neon`. Tried importing directly and iteratively using entry points.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 657, in _addDevices
    self.createNewMonitoredDevice(dev_cls_name, dev_conf)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/server.py", line 736, in createNewMonitoredDevice
    raise ioHubError('Error during device creation ....')
psychopy.iohub.errors.ioHubError: ioHubError:
Args: ('Error during device creation ....',)

** WARNING: Mouse Tap Disabled due to timeout. Re-enabling....: 4294967294
Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/client/__init__.py", line 1096, in _addDeviceView
    dev_import_result = import_device(dev_mod_pth, dev_cls_name)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/devices/__init__.py", line 1017, in import_device
    module = importDeviceModule(module_path)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/devices/__init__.py", line 1007, in importDeviceModule
    raise ModuleNotFoundError(
ModuleNotFoundError: Could not find module `psychopy.iohub.devices.eyetracker.pupil_labs.neon`. Tried importing directly and iteratively using entry points.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/client/__init__.py", line 1099, in _addDeviceView
    dev_import_result = import_device("psychopy.iohub.devices", dev_cls_name)
  File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/iohub/devices/__init__.py", line 1020, in import_device
    device_class = getattr(module, device_class_name)
AttributeError: module 'psychopy.iohub.devices' has no attribute 'EyeTracker'

@TEParsons
Copy link
Collaborator Author

Sorry for the delayed reply, been a busy few weeks!

I think the solution we came to with other eyetrackers (see Eyelink, Tobii and Gazepoint ) was that the entry point needed to point to a module containing a class called EyeTracker rather than pointing to subclasses of EyeTracker. I'll close this an open a new PR with what I think should work instead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants