Hi Jon,
That’s good info! Yeah, that’s pretty much what I could intuit from reading the PTB updates/forum posts about setting up the business model process and costs, but wasn’t sure if you had any behind-the-scenes additional information. It seems like he mostly focuses on making PTB work well for MATLAB so there wasn’t much info about running it on MacOS or the Python package.
Yes and no re: native ARM. ;tldr, we don’t have a setup that works natively with Silicon chips, but we have managed to get something working on our M4 laptops.
For posterity (and since I couldn’t find many recent posts on the forum about this): We first just tried to pip install psychopy in a clean conda environment, but were getting all sorts of issues. Then, we tried to follow these instructions, but we ran into the first known issue they list (an import issue with PTB):
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/_____/psychopy-on-M1/venv/lib/python3.10/site-packages/psychtoolbox/__init__.py", line 26, in <module>
from .WaitSecs import WaitSecs
ImportError: dlopen(/Users/____/psychopy-on-M1/venv/lib/python3.10/site-packages/psychtoolbox/WaitSecs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_ActivateLicense'
When I first was working on this, I assumed that it was an issue with ARM (since we were getting errors that looked a lot like that previously), but now looking at it, I’m not actually not sure if this is the fact that we don’t have a license. Regardless, it wasn’t working, so we pivoted.
Ultimately, what we ended up doing was creating an Intel environment via conda:
CONDA_SUBDIR=osx-arm64 conda create -n psychopy_env_x86 -c conda-forge
and then pip installed psychopy with the dependencies (python version 3.10.16) - this got us psychopy==2024.2.5 and psychtoolbox==3.0.19.14. Notably, this version is NOT the version of PTB that runs natively on ARM, and from the PTB side, it does seem like they recommend going up to 3.0.20 for this reason (timing, etc). We haven’t tested this at all so I don’t know how bad the timing issues are (/ if they’re an issue at all).
That allowed us to successfully import the packages, but we still were coming across issues with PTB having access to the keyboard - PTB had some instructions to change security settings (allow Terminal access to Input Monitoring in Security & Privacy) but after doing that, we still got the following error:
PTB-WARNING: During PsychHID invocation: Some other running application is preventing me from accessing the keyboard/keypad/mouse/...!
PTB-WARNING: This is likely a security measure, e.g., to protect some active password entry field.
PTB-WARNING: Please identify and quit the offending application. E.g., some versions of Firefox are known to cause such problems...
What fixed this was also giving Terminal access to Privacy & Security → Accessibility in addition to Input Monitoring.
After doing all these steps, we were successfully able to run the keyNameFinder.py
Coder demo with both the iohub and ptb backend (although it didn’t seem to work with the event backend). We also had some weirdness with using the psychopy iohub module but we figured out that it worked well with the psychopy.hardware.keyboard.Keyboard()
object so we didn’t dive too deeply into this.
Catherine