| 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?


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.