psychopy.org | Reference | Downloads | Github

Keyboard psychtoolbox/hid failing with Mac OS Catalina update

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Mac OS Catalina 10.15
PsychoPy version (e.g. 1.84.x): Psychopy 3.4.3
Standard Standalone? (y/n) If not then what?:yes
What are you trying to achieve?:
run the Demo
What did you try to make it work?:
run the Demo

What specifically went wrong when you tried that?:
Throw the following errors:

defaultKeyboard = keyboard.Keyboard()
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 166, in init
buffer = _keyBuffers.getBuffer(devId, bufferSize)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 306, in getBuffer
kb_id=kb_id)
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/hardware/keyboard.py”, line 334, in init
self.dev = hid.Keyboard(kb_id) # a PTB keyboard object
File “psychtoolbox/hid.pyc”, line 137, in init
File “psychtoolbox/hid.pyc”, line 145, in _create_queue
FileNotFoundError: [Errno 2] No such file or directory

Include pasted full error message if possible. “That didn’t work” is not enough information.

Dear all,

I face the same problem (and get the same error messages) within PsychoPy v3.1.5 as well as in PsychoPy v3.2.4 on Mac OS Catalina 10.15.

In addition to the above stated error messages (of Fiona), mine are preceded by further error messages. As I am not sure about possible interactions between those errors, you can find the error messages below:

PsychHID-ERROR: Could not enumerate and attach to all HID devices (HIDBuildDeviceList(0,0) failed)!
PsychHID-ERROR: One reason could be that some HID devices are already exclusively claimed by some 3rd party device drivers
PsychHID-ERROR: or applications. I will now retry to only claim control of a hopefully safe subset of devices like standard
PsychHID-ERROR: keyboards, mice, gamepads and supported USB-DAQ devices and other vendor defined devices and hope this goes better…
PsychHID-INFO: That worked. A subset of regular mouse, keyboard etc. input devices and maybe some vendor defined devices will be available at least.
INTERNAL PSYCHTOOLBOX ERROR
error: PsychError_system
general description: Error reported by a system call
specific description: Failed to create event queue for detecting key press.
module name: PsychHID
subfunction call: KbQueueCreate
file name: ./PsychSourceGL/Source/OSX/PsychHID/PsychHIDStandardInterfaces.c
function name: PsychHIDOSKbQueueCreate
line number: 956
PsychHID:KbQueueCreate: See error message printed above.

Do you have any recommendations/ideas how to fix this/these issue(s)? Or do you need further information?

All the best and thanks in advance,
Hannah

Same problem as @hannah. Everything works fine on PC, but we got those error messages when trying the same experience on Mac…

The same problem occurred to my computer, and I have found the following solution.

Please go to System Preferences > Security & Privacy > Privacy tab > Input Monitoring (i.e. keyboard icon) > Add PsychoPy3 by pressing the plus button (i.e. Allow PsychoPy3 to “monitor input from your keyboard even while using other apps”).

I think the new OS has reset our privacy settings and forbidden Psychtoolbox-based keyboard input as a default. I would be happy if this information is helpful to you.

1 Like

Thank you for your answer, but actually that does not help in my case. I have the same issues and error messages as before. When trying the demos, the experiment setting window (participant name and session) pops up, afterwards everything closes and I get the error report.

But which PsychoPy version are you using?

I’m using version 3.1.2. The same issue is reported below, and @j_adema solved it by downgrading PsychoPy3. So, PsychoPy version might have something to do with it. I’m sorry but I don’t know anymore.

Thanks for merging those two topics! That should probably help at least on the short run - I will try it later today.

Great, this solutions seems to work! Thanks again!

I now tried the 3.1.2-Standalone and the 3.2.3-Standalone. In both cases I changed the privacy settings according to your description @fheiuap. Afterwards at least the demos seem to work…

A summary of what to do when facing problems with the Mac OS Catalina Update and PsychoPy (3.2.4) - at least on the short run.

Downgrade your PsychoPy3 (3.2.3 seems to work at least for me).
After installation change your privacy settings according to @fheiuap’s description:

Please go to System Preferences > Security & Privacy > Privacy tab > Input Monitoring (i.e. keyboard icon) > Add PsychoPy3 by pressing the plus button (i.e. Allow PsychoPy3 to “monitor input from your keyboard even while using other apps”).

2 Likes

Thanks for sharing your solutions!

I just upgraded from macOS Sierra to Catalina and found the same issue about loading keyboard functions on PsychoPy3 (3.1.4). I couldn’t find the plus button on the Input Monitoring under Privacy tab. This panel was just empty.

Instead, I upgraded my current PsychoPy3 v3.1.4 to v3.2.4, run it by allowing an opening access (as it usually complains about unidentified developer) and the issue was gone.

To summarize, I did two things to fix this issue:

  1. Upgraded PsychoPy3 to the latest version (v3.2.4) and
  2. Allowed an access to open this app.

This does not work for me, with 3.2.4. Although I’m a bit unclear about what you mean by ‘allowing open access’. I’ve given it access to input monitoring as others have mentioned.

What I meant by ‘allowing open access’ was as follows.

A small warning window popped up when I opened PsychoPy for the first time after upgrading it the v3.2.4. I clicked the ‘allow’ button on the warning window. Now, this warning is not appearing anymore, so I don’t remember/replicate the exact warning message, but it was about if I want to allow open access for the program that is from the unidentified developers.

I think you can find this message also on ‘Security & Privacy’ panel under System Preferences as in the image below if you missed this warning for some reason or when PsychoPy refused to open.

Others mentioned adding a keyboard on Input Monitoring, but I couldn’t add anything there, which looks as in the bottom image. I don’t have any issue right now using keyboard input on PsychoPy without adding a keyboard in this panel.

I don’t know if my solution works for everybody, but this worked for me at least.

Yep. The “open anyway” thing in security settings will have to be done anyway by everyone I believe, so I think you have just been lucky in somehow getting 3.2.4 working with Catalina.

Ok. So downgrading to 3.2.3 as @Hannah says and making sure PsychoPy has access to input monitoring does not fix the problem for me. So as far as I can tell there is no way for me to run PsychoPy experiments on this machine with Catalina. I’ve not yet tried going back to even earlier versions of PsychoPy.

EDIT: This does work if you downgrade to 3.2.3 if you also go into Settings > Security & Privacy > Privacy > Input Monitoring and remove PsychoPy3 then let it add itself back again. :slight_smile:

I had 3.2.3 installed on my computer, and upgraded to 3.2.4. After doing so, I experienced the same problem. This was solved by removing PsychoPy3 from Input Monitoring, and then add it again when starting the software. By doing so I could run 3.2.4 on Catalina. Hope it helps.

2 Likes

Thanks @mijdar

Annoying that Mac didn’t previously require it to be in Input Monitoring at all, but I suspect the reason your solution works is that Mac treats 3.2.4 as an entirely separate entity to 3.2.3, which means this might have to be done on every update! :frowning:

I really need to get the auto-updating via a patch file to work again which would get around the problem.

Unfortunately I have to buy a new Mac today and it will be Catalina OSX. Hopefully these hints will help me through. Now that Jon is on it, it will will be fixed. I wonder though its is related to a problem I had with IOHub and the keyboard. I know that IOHub keyboard and the keyboard component are completely different but I am asking this in case it sheds some light on the Apple Permission issues. With Mac OSX Mojave, I could not run the IOHub keyboard, but if I interpreted the program and put it into Anaconda/Spyder, IOHub keyboard programs would work perfectly. I hope I do not run into the Catalina PsychoPy issues, but if keyboard (component) does work with Anaconda, I will be more hopeful that ALL these problems will be solved (until Apple intervenes again). If you try this, let me know.

Hi Bill, on a related note, if it is only the keyboard aspects you need, then the new PsychToolBox-based Keyboard class probably achieves everything you need, without requiring ioHub:

https://www.psychopy.org/api/hardware/keyboard.html

Michael,

Thanks for replying. It’s a long story. My long-term goal was to make a Toby eyetracker work. I couldn’t do it so I thought maybe the problem was I don’t understand IOHub. So I tried the demos for mouse and keyboard IOhub. They didn’t work with PsychoPy but they did work running under Anaconda. Why? I tried Different versions of PsychoPy , and mostly OSX Mojave.

So then why couldn’t I get to Toby eye monitor to work under Anaconda. Then I discovered one version just will not work, Toby will not give away the code. I tried with the EyeX, which should work and it doesn’t. But now I’m thinking maybe the computer (an old MacBook Air) doesn’t put out enough power in the USB port. But I have to buy a new computer and it will be OS X Catalina. With your note, and the other hints in this discussion, I think the keyboard component won’t be a problem (I hope).

But there still some problem with securities and permissions with OS X Mojave and PsychoPy, at least on my computer. There’s nothing wrong with the demonstration code, it works perfectly when the .py is run with Anaconda, But not with PsychoPy. But this doesn’t appear to have been a problem for other people. So it must be some privacy permission was set incorrectly in my computer and I don’t know how to fix it.

For now I’m going to give up on IOhub. There are a lot of suggestions on the keyboard component, so I expect that will work.

Bill Prinzmetal