I’m currently designing PsychoPy experiments that will be used at an MRI-scanner facility. Some of the experiments will be done with the participant inside of the MR camera, others outside of it. In both cases we need to run PsychoPy on computers used by different research groups.
When we asked about using PsychoPy at the facility the staff sighed, because they’ve had issues with running different versions of PsychoPy on the computers. Some research groups have experiments that are >5 years old while others (including us) want to use one of the latest versions. They’ve tried using anaconda but they still have problems now and then. It’s a problem for us if we can’t rely on PsychoPy working as expected when we get there, and to me it’s also a shame that the staff’s view of PsychoPy (which I mostly quite like) is darkened by this.
So, I’m trying to figure out the best way to tackle this challenge of running PsychoPy experiments built using vastly different versions. I’m thinking that if I can figure this out, it would help the project I work for, and I could share the info with the MRI staff as well and hopefully brighten their opinion on Python.
Looking through the forums I’ve found similar earlier threads, with different proposed solutions, e. g.:
- https://discourse.psychopy.org/t/install-two-different-psychopy-versions-in-parallel/2227 - Install complete standalone Psychopy versions, making sure to rename the older version before adding another
- https://discourse.psychopy.org/t/several-installations-of-psychopy-windows/1672 (mentions that separate standalone installations aren't possible - maybe this changed in the time between this and the previous thread?) - use:
import psychopy psychopy.useVersion('1.80.02')
(it’s mentioned however that “that doesn’t really work for Builder though”)
https://discourse.psychopy.org/t/concurrent-versions/9609 - use the useVersion function to control which version of PsychoPy is used to run the task. This can be set from Experiment Settings > Use Version.
My workflow is that I put together experiments in the Builder, let it generate a .py script, and then add some tweaks in the Coder View for specific functionality that’s needed. The end product is a .py file, with accompanying stimuli and a .csv file for loop variable values.
If I’ve understood things correctly I can’t really run my .py files directly from the command line, since PsychoPy requires a specific environment, meaning the script has to be opened and run using the PsychoPy app/program. (so I use
open -a /Applications/PsychoPy3.app my_script.pyin the Terminal) This stops me from just using pipenv to create a virtual environment for version control (please correct me if I’m wrong).
Now, if one has installed the standalone version 3.2.4 of PsychoPy, can one simply add the import statement and
python.useVersion(’<version_no>’)to the beginning of the .py script in the Coder view? And then everything will work out fine as long as the correct version is specified, no matter how old that version is? Also, does one have to have git installed, as this thread seems to suggest?
And if people prefer, can they simply open up their .psyexp file, go to Experiment Settings in the Builder View, then choose the version they need? Looking at this setting on my computer, I see versions spanning from 1.90.0 to 3.2.4 - is a separate standalone installation required if someone needs to use versions earlier than 1.90.0?
If anyone can help me out on this I would be very grateful Versioning in my limited experience seems to almost always be a headache in Python, and so everything I can get right from the get-go is a godsend.