ModuleNotFoundError: No module named 'psychopy.tests'

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win7 and MacOS 10.14.6
PsychoPy version (e.g. 1.84.x): v2021.2.3 (Win7) & v2021.2.2 (MacOS)
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: Run the experiment

What did you try to make it work?: Run the experiment from the Builder/Runner. Run the compiled python script directly. Eventually commented out the offending import line, and all references to the imported variable.

What specifically went wrong when you tried that?:

Traceback (most recent call last):
  File "", line 22, in <module>
    from psychopy import sound, gui, visual, core, data, event, logging, clock, colors
  File "/Users/jonathanshor/.psychopy3/versions/psychopy/visual/", line 31, in <module>
    from psychopy.visual.backends import gamma
  File "/Users/jonathanshor/.psychopy3/versions/psychopy/visual/backends/", line 20, in <module>
    from psychopy.tests import _vmTesting
ModuleNotFoundError: No module named 'psychopy.tests'

That is the error from MacOS. The error on Win7 is essentially the same, referencing the same line in

The errors are not reached in identical ways, however. On Win7, the error happened when trying to run from the Builder mode. On MacOS, running from Builder mode actually works, but trying to run the compiled script from the command line produces the error above.

After doing a little digging, it seems the psychopy install referenced in the pasted error there, under .psychopy3/, is v2021.2.2 and is missing the tests subfolder, which I imagine is causing the failure. Bizarrely, the psychopy install for my python venv is v2021.2.3 and does have the tests subfolder… I’m quite confused how the Builder is finding that, but calling python from within the venv somehow finds the other install.

Regardless, the Win7 machine is my ultimate target machine. Why do some installs omit the tests folder, and should I simply copy the folder from the 2021.2.3 Mac install over to the Win7 machine?

In case it matters, the experiment was designed in the v2021.2.2 Builder, and I’m using psychopy.useVersion('2021.2.2') in the code.

It seems that it did matter a lot that I’m using that psychopy.useVersion('2021.2.2'). When I do not use any useVersion, it runs, or even when I set the Version to 2021.2.3 or 2021.2.1, it runs fine.
For whatever reason, the code it downloads for 2021.2.2 is missing the tests folder and fails.

I just upgraded my installed version to 2021.2.3 and stopped using an useVersion statement, and it seems fine.


Running into same issue as Jonathan. I need to run the same experiment on two separate computers. I downloaded Psychopy (newest version) onto one computer and the other computer has an older version from 2021 (v2021.2.3). The script is not compatible with the new version and I would like to run it on the older Psychopy version. Any idea how to fix this?


Your answer saved my day