The current version of PsychoPy runs on Apple Silicon (e.g. M1, M2, and later) Macs through Rosetta 2. Below are instructions to run a native Apple Silicon (arm64) version of PsychoPy.
Install brew to install various apps needed for PsychoPy.
brew install [email protected]
Python 3.10.14 (19 Mar 2024).
git clone https://github.com/waltervanheuven/psychopy-on-M1.git
cd psychopy-on-M1
python3.10 -m venv venv
# activate venv
source venv/bin/activate
# update pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
Install PyQt6 version 6.7.1
pip install PyQt6
tables version: 3.10.2.dev0
Using latest development version to avoid compiling issues.
brew install hdf5 c-blosc lzo bzip2
export HDF5_DIR="$(brew --prefix hdf5)"
export BLOSC_DIR="$(brew --prefix c-blosc)"
export LZO_DIR="$(brew --prefix lzo)"
export BZIP2_DIR="$(brew --prefix bzip2)"
pip install git+https://github.com/PyTables/PyTables
Note: opt
folder of homebrew for Apple silicon is located in /opt/homebrew/
. On Intel macs it is located in /usr/local/
.
To find correct path on both architectures use brew: $(brew --prefix ....)
.
psychtoolbox version: 3.0.19.14
pip install git+https://github.com/Psychtoolbox-3/[email protected]
wxPython version: 4.2.1
export CFLAGS="-I/$(brew --prefix)/include"
export CXXFLAGS="-I/$(brew --prefix)/include"
pip install wxPython
brew install ffmpeg
Using PsychoPy source.
mkdir tmp
cd tmp
wget https://github.com/psychopy/psychopy/archive/refs/tags/2024.2.1.zip
unzip 2024.2.1.zip
# replace pyproject.toml with amended version:
# - disabled setuptools because latest version already installed in venv
# - downgraded python-bidi from 0.5.0 to 0.4.2 so that Preference window works
# - disabled PyQt6 because already installed in venv
# - disabled psychtoolbox because already installed in venv
# - disabled tables because already installed in venv
# - disabled wxPython because already installed in venv
cd ..
cp pyproject.toml tmp/psychopy-2024.2.1/
cd tmp/psychopy-2024.2.1
python3 -m pip install .
cd ../..
pip install psychopy-pyo
psychopy
Please note that PsychoPy fails to start without any error message appearing in the Terminal when Secure Keyboard Entry
is enabled in the Terminal. Make sure this is turned off
.
- Psychtoolbox (PTB) import issue
PsychHID.cpython-310-darwin.so
is an Intel library. There is not yet an Apple Silicon version of this library. Therefore, importing psychtoolbox
fails.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../venv/lib/python3.10/site-packages/psychtoolbox/__init__.py", line 28, in <module>
from .PsychHID import PsychHID
ImportError: dlopen(.../venv/lib/python3.10/site-packages/psychtoolbox/PsychHID.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_libusb_bulk_transfer'
Event module is therefore used for the keyboard component.
-
Microphone component is not working
Microphone component fails because Psychtoolbox import fails.
-
If
timeByFramesEx.py
fails to run, change line 34 tomatplotlib.use('QtAgg')
.Note that there is vsync OpenGL bug in macOS Ventura/Sonoma so vsync doesn't work correctly.
-
Eyetracker components not working
Unable to install tobii-research because there is not yet Apple Silicon support for the Tobii Eyetrackers Python library.
-
PsychoPy fails to start again after exiting PsychoPy
Issue might be due to sandboxing. Fix this by installing the Intel (Rosetta 2) version of PsychoPy 2024.2.1 and starting this up once before trying again the Apple Silicon version.
If this still fails, uncheck "Secure Keyboard Entry" in the Terminal / iTerm2.
-
Unable to revert mtime: /Library/Fonts
errorFix this by installing
libmagic
.brew install libmagic
-
Drivers for Apple Silicon Macs
- USB driver for Cedrus response box/Stimtracker (ARM) download D2XX direct driver
-
Error when creating wheels (e.g. gevent)
Could be an issue with a beta version of xcode tools installed on your Mac. Revert back to latest (non-beta) version.
sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install
-
Other issues
For other issues it might help to clear the pip cache.
pip cache purge
If PsychoPy fails to start up after you have changed the preferences, remove the file userPrefs.cfg
.
rm ~/.psychopy3/userPrefs.cfg
Benchmark wizard report (14" M1 Max MacBook Pro, macOS 14.6.1).
Previous version results:
PsychoPy | ||
PsychoPy | 2024.2.1 | |
locale | None.UTF-8 | |
python version | 3.10.14 (64bit) | |
wx | 4.2.1 osx-cocoa (phoenix) wxWidgets 3.2.2.1 | |
pyglet | 1.5.27 | |
rush | True | |
Visual | ||
openGL version | 2.1 Metal 88.1 | |
openGL vendor | Apple | |
screen size | 3024 x 1964 | |
have shaders | True | |
visual sync (refresh) | 7.28 ms | 1 |
refresh stability (SD) | 5.41 ms | 1 |
dropped frames | 75 / 181 | 1 |
openGL max vertices | 1048575 | |
GL_ARB_multitexture | True | |
GL_EXT_framebuffer_object | True | |
GL_ARB_fragment_program | True | |
GL_ARB_shader_objects | True | |
GL_ARB_vertex_shader | True | |
GL_ARB_texture_float | True | |
GL_ARB_texture_non_power_of_two | True | |
Numeric | ||
numpy | 1.26.4 | |
scipy | 1.14.1 | |
matplotlib | 3.9.2 | |
System | ||
platform | darwin 14.6.1 arm64 | |
CPU speed test | 0.003 s |
1
There is a vsync OpenGL issue on macOS Ventura/Sonoma.
Result of running timeByFramesEx.py
(60Hz LCD screen of M1 MacBook Pro, expected mean = 16.67 ms):
Note that vsync is working fine with PsychoPy in macOS Monterey 12.6.X (no dropped frames and stable vsync). Furthermore, you can run macOS virtualized using VirtualBuddy on Apple Silicon. Running a virtualized macOS works very well and the frame rate in PsychoPy is then stable.