Cannot install psychopy through pip on MacOS M2

Hi everyone,

I want to use “pip install psychopy” on MacOS M2, but the error messages below keep showing:

I have already tried several methods regarding to HDF5 (like using homebrew to install then change the path), but nothing worked.
Does everyone here encounter the same problem? Or does any of you have any suggestions?
Thank you very much!

3 Likes

For anyone encountering this in future. I ran:

brew install hdf5

then

export HDF5_DIR=/opt/homebrew/Cellar/hdf5/1.14.3/

then

pip3 install psychopy

and this worked! Try to find the location of your H5public.h file to replace the path in the export line

1 Like

Hi Becca,

Unfortunately, I followed the steps but I keep getting this error on MacOS:
AttributeError: module ‘pkgutil’ has no attribute ‘ImpImporter’. Did you mean: ‘zipimporter’?

For Mac silicon, compiling tables/hdf5 is hard (as you’ve found) and psychtoolbox is currently impossible (so you won’t get low-latency audio).

I strongly recommend for now that you stick to Standalone PsychoPy

If you need your own python that you use it in Intel mode with Rosetta translation. That would mean going into terminal, setting up a virtual env and using that virtual env while in intel architecture mode to install your dependencies. You’ll then need to switch to intel mode and activate the virtual env whenever you use psychopy

1 Like

Thanks a lot for your reply. I am using the standalone originally but have been facing some issues , and I wanted to debug in an IDE, and that’s why I started this