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