psychopy.org | Reference | Downloads | Github

No module named 'psychopy'

I am writing code to connect eeg device with my computer using python, and when I run the code I got this error
ModuleNotFoundError: No module named ‘psychopy’

Please I need you help to solve this problem :pleading_face:

It looks like you don’t have psychopy installed in the python environment you are using. If you have installed the PsychoPy via an installer - this gives you, in short, a separate python environment with psychopy installed, but your other python environments don’t have access to psychopy this way. Two proposed solutions:

  • run your code via PsychoPy Coder
  • install psychopy into the python environment you are using either via pip install psychopy or conda isntall psychopy -c conda-forge. I didn’t use the pip install option so I don’t know if it is painless, but the conda installation is very simple and worked well on a few computers I tested it on.

BTW. I’m not sure if it is a good idea to run psychopy from jupyter notebook (as your screenshot suggests). I remember there were voices that it shouldn’t be done, but it was long time ago. @jon is it sill the case that running psychopy from jupyter notebook should be avoided?

The issues with Jupyter notebooks are:

  • I don’t know what overhead they add (e.g. debugging hooks etc). It may be fine, I’m just saying I don’t know - I haven’t tested the impacts on timing etc.
  • you may need to set the correct python interpreter (“kernel” jupyter lingo?) being used, which is probably the case here
1 Like

Thank you so much sir for mentioning Mr Jon because his solution solved my problem.

Thank you so much Mr Jon, your solution has solved my problem.