TLDR: Can a developer please tell us what the situation is with the psychtoolbox import that is normally used by Psychopy’s sounds, and what alternative we might use?
Long version
On multiple Mac M-chip machines, we (Viplav Tuladhar, De-Wei Dai, and myself) are trying to run Psychopy using VSCode rather than through the Standalone IDE or Psychopy Studio. This problem does not seem to occur on Windows.
I will give the full setup/installation instructions below, but the result is that we get this error
ModuleNotFoundError: No module named ‘psychtoolbox’
when we execute the following two lines of code:
from psychopy import sound
highA = sound.Sound('A', octave=3, sampleRate=44100, secs=0.8, stereo=True)
The traceback reveals that psychtoolbox is needed by psychopy/hardware/speaker.py, as it includes
import psychtoolbox.audio as ptb
This issue does not occur when using the standalone Psychopy builder and Coder, only when using an interpreter we have installed, which in our case we did in the following way:
conda create python=3.10 -n psychopy310
activate the environment using
conda activate psychopy310
and then use pip to install psychopy into that environment.
pip install psychopy
A somewhat-unsatisfactory workaround, we discovered, is to use psychopy_x86 through Rosetta rather than native on ARM, which we did by installing psychopy_x86 (python 3.10.18) with conda and attached it to Visual Studio Code as an interpreter. But that does work.