Error finding psychopy when running experiment directly from terminal

OS: MacOS Mojave version 10.14.6
Psychopy version: 2021.2.3
Python version: 2.7.16
Python 3 version: 3.9.13

I am trying to run an experiment directly from the terminal, rather than having to open psychopy (it’s a slightly old macbook, and it takes a while for the psychopy GUI to open up).

if I run it using

python /path/to/

I get the error ImportError: No module named psychopy. If I look for psychopy with which psychopy, or try to import from psychopy, it also fails to find it.
Psychopy is definitely installed (and in the Applications folder), and running the psyexp file from within the GUI works fine. If I try to (re)install psychopy using homebrew, it says that it is already installed (and linked).

I’m not sure how to get python to recognise psychopy, and much searching online, including these forums, has gotten me nowhere so far.

[EDIT: trying to install psychopy via pip fails, so far as I can tell due to deprecated dependencies (namely pocketsphinx). I don’t know if this matters.]


If the only thing stopping you using the PsychoPy GUI is the speed of launching, then you really should just use the GUI.

The advantage of using the GUI is that it comes packaged with its own version of Python, complete with all required dependencies. If you don’t want the benefit of that, you will have to install your own Python environment (version 3.6 or 3.8?) and handle all the complexities of managing the various dependencies. Even if you were familiar with this sort of thing, the time taken will likely far exceed the time spent waiting for the standalone GUI to launch. The PsychoPy developers have solved all of that, precisely so you don’t have to.