PsychoPy Module in Spyder

Hello,

I’m trying to teach myself Python using the textbook Python for Experimental Psychologists. In one of the first chapters, the author suggests using Spyder, and then talks about building an experiment using the PsychoPy module.

However, when I follow the instructions and try to run the script in Spyder (e.g. from psychopy.visual import Window), I get this error:

ModuleNotFoundError: No module named ‘psychopy’

I’ve looked online and seen lots of ways of solving this. Some have suggested adding paths to PsychoPy using PYTHONPATH manager, but I can’t find the folder needed (which ends with .egg). Others have suggested installing PsychoPy in its own environment following these instructions (Installation — PsychoPy v2022.2.4), but this just gives me another error:

SpecNotFound: Invalid name ‘psychopy’, try the format: user/package

Furthermore, if I run pip install psychopy, it runs for a few seconds, then gives me a string of errors like this:

ERROR: Failed building wheel for dukpy

  • ERROR: Command errored out with exit status 1:*

ERROR: Failed building wheel for pyWinhook

  • ERROR: Command errored out with exit status 1:*

And then this message:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

    • psychopy → python=2.7*
    • pyglet → python[version='2.7.|3.4.|3.5.']

Your python: python=3.9

Essentially, I’m very confused and have wasted most of my morning trying to sort this out. Any help would be hugely appreciated! I just want the psychopy module to work in Spyder. Python, PsychoPy, and Anaconda are all up to date with latest versions installed. Thank you!