| Reference | Downloads | Github

Importing certain iohub modules failed with the latest psychopy installation


As stated in the title, I get importing error even with the iohub demos packaged within:-

Running: D:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\iohub\ioHubDelayTest\

Traceback (most recent call last):
File “D:\Program Files\PsychoPy2\lib\site-packages\psychopy\demos\coder\iohub\ioHubDelayTest\”, line 21, in
from psychopy.iohub import Computer, ioHubExperimentRuntime, EventConstants
ImportError: cannot import name ioHubExperimentRuntime

EventConstants (and possibly others which I haven’t quite figured out?) also seem to be missing. Any idea if this is just me, or are people getting this as well?

1 Like

Hi Aaron, I’m encountering a very similar problem when I try to run a script that includes importing ioHubExperimentRuntime. Were you able to solve this? Thanks so much for any help.


Were you getting “importError: cannot import name ioHubExperimentRuntime” or something like that?

If your method of calling module imports is based on (or something like) this old eyetracking test script - which I am doing at the moment ( from github , this particular import I think, might be a problem:-

from psychopy.iohub import (EventConstants, EyeTrackerConstants, 
getCurrentDateTimeString, ioHubExperimentRuntime)

I was looking into the .py files in psychopy.iohub and realised that EventConstants and EyeTrackerConstants are in the file, but not getCurrentDateTimeString and ioHubExperimentRuntime. I think something got shifted around during updates?

I had to change it to the following in order to successfully import EventConstants and EyeTrackerConstants:

from psychopy.iohub.constants import (EventConstants, EyeTrackerConstants)

getCurrentDateTimeString and ioHubExperimentRuntime doesn’t seem be in the script, and I can’t seem to locate it at the moment. Perhaps @jon or @sol knows where we can properly import these two modules from to get them to work?

EDIT: Found the update notes for iohub here:

Is there a recent iohub demo that we can refer to in the light of the recent changes? Because the file that was uploaded 5 months ago onto github seems to be outdated, and does not reflect many of the changes listed on the patch notes.


Any updates on this? The current iohub demos do not work, giving the following error:

ImportError: cannot import name ioHubExperimentRuntime

But I can’t find ioHubExperimentRuntime to try to change the import for myself.


Hi there,

iohub modules have been changed dramatically from psychopy version 1.86 onwards as far as I am aware of, but the iohub demos were not updated accordingly. There are not a lot of comprehensive resources online at the moment on how to work with the new updates apart from needing to wait for the “Programming Experiments in Python” book (which revolves around coding with psychopy) that will only be out in 2019-2020.

My current solution is to actually downgrade your psychopy version to 1.85.4 and below (1.85.4 works for me at the moment) if you wish to work with the old codes.


does anyone have working examples of ioHub process with PsychoPy 1.90.+ ?
ioHub demos are not working on my windows 10 machine giving similar import errors. The same is with my previously working experimental procedures codes.

I’m using ioHub for connecting with eye trackers.
It is really frustrating that the update in the basic usage is done with very insufficient documentation.


Just a heads-up, I did a text search in the PsychoPy library files. It looks like all mention of ioHubExperimentRuntime got completely purged from the later versions of PsychoPy (both 2.7 and 3), except for the demos. In other words, all 5 demos that rely on the module are broken. The demos are:

eyetracking/selectTracker and eyetracking/gcCursor

@jon, should the demos be removed, or is it planned that the iohub support will be re-added at a later point?

1 Like


Is there any update on the ioHub process with PsychoPy 1.90.3 or more recent?
If not, any recommendations for a new programmer getting eye tracking to work in PsychoPy?


Sorry for the late reply.

I suggest getting to know pylink. Check out the official sr-forum documentation:

It’s now much better supported than before.