Cannot run standalone psychopy if PYTHONPATH and PYTHONHOME set for different python version

793 Views Asked by At

I thought that the standalone PsychoPy install could coexist happily if Python was installed separately on the PC to but I can't get it to, nor can I find any docs. (I'm using Windows 7)

I have the lastest standalone version installed and the shortcut to run it is

"D:\Program Files (x86)\PsychoPy2\pythonw.exe" "D:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.81.02-py2.7.egg\psychopy\app\psychopyApp.py"

This works fine if my system env variables for PYTHONHOME & PYTHONPATH aren't set but I also use Python for other apps and need them setting to point to the other version of Python I have installed natively. When these env vars are set, Psychopy fails to load and gives no error messages at all.

Can anyone advise how I get them to play together nicely? (I thought it used to work last year, has something changed?)

[ I've tried a full uninstall of psychopy and freshly installed the latest standalone version v1.81.02

2

There are 2 best solutions below

0
On

Yes, this is an unfortunate consequence of the way that PsychoPy is currently bundled with it's own closed environment in it's own python and dependencies installed seperately.

However, a new option to install psychopy using the conda package manager was introduced recently for Mac OS but some have also got it to work on Windows with a bit of tweaking.. Work is currently ongoing for this feature. I doubt that it was working previously unless you manually installed all dependencies in your default python, or ran linux:

On linux you can simply install psychopy from the neuro.debian repository, making it available for python system-wide. See PsychoPy documentation.

0
On

Thinking about it, I don't think it would ever worked if you had set PYTHONPATH (I don't know about PYTHONHOME).

BUT I did have a 'regular' python installation running alongside my Standalone PsychoPy install by not using the PYTHONPATH variable. You can add further paths to your python importing path (I assume that's the aim here) without setting any environment variable by adding text files ending in .pth to your site-packages directory. Essentially any lines in a .pth file that is found while navigating the existing path will also be added to the path!

Actually, according to the python docs you can also set a flag -E to ignore the environment variables: https://docs.python.org/2/using/cmdline.html To use that solution for the Standalone PsychoPy installation you'd have to alter the application shortcut to add this (that should get the app to load), but also make a couple of changes to the code for running scripts so that they also run with the flag set.

I still think not setting those variables is the easier solution though.

cheers, Jon