I’m new to Python and Psychopy. I’ve tried running the following:
print("foo")
from psychopy import visual, core, gui, event
print("bar")
Both from the command line and inside the Spyder IDE, I get the following error:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from psychopy import visual, core, gui, event
ModuleNotFoundError: No module named 'psychopy'
System specs: macOS High Sierra v.10.13.4, Macbook Air
Python version: Python 3.7.1 (python -V)
I’ve installed the following dependencies: wxPython, pyo, and the ones in the following code:
pip install numpy scipy matplotlib pandas pyopengl pyglet pillow
moviepy lxml openpyxl xlrd configobj pyyaml gevent greenlet
msgpack-python psutil tables requests[security] pyosf cffi
pysoundcard pysoundfile seaborn psychopy_ext python-bidi psychopy
pip install pyserial pyparallel egi iolabs
pip install pytest coverage sphinx
pip install pyobjc-core pyobjc-framework-Quartz
I also tried using pip3. iolabs was not able to install but the link below seems to state it is optional.
All from this resource. It seemed to run without a hitch (aside from some that didn’t like Spyder, but I ran it on the command line as well as Spyder, so that shouldn’t be a problem).
Any suggestions?
It's better to create a virtual environment. Can you try the following command lines in your terminal?:
conda create -n psychopy python=3.6 anaconda
# it creates a virtual env named psychopy
source activate psychopy
# it activates this virtual environment
pip install psychopy
# it installs psychopy lib in the virtual environment.
Then, to try the used-case here again, type:
python
# it opens python
>>> from psychopy import visual, core, gui, event
It should work.