psychopy.org | Reference | Downloads | Github

How to run PsychoPy after Pip2 install

Hi all,

I ran into an issue with 1.8.2 version from Ubuntu apt-get which crashed, and the NeuroDebian repo only has 1.8.3 which had other problems.

However I think I have successfully installed the 1.8.5 Psychopy libraries via Pip2 as follows (iolabs wasn’t available for Ubuntu, and I didn’t use the ‘developer’ approach of getting direct from Git)…

sudo pip2 install numpy scipy matplotlib pandas pyopengl pyglet pillow moviepy lxml openpyxl xlrd configobj pyyaml gevent greenlet msgpack-python psutil tables requests[security] pyosf cffi pysoundcard pysoundfile seaborn psychopy_ext python-bidi psychopy
sudo pip2 install pyserial pyparallel egi
sudo pip2 install pytest coverage sphinx

However, there don’t seem to be any instructions for how to run it after such an install.

The sudo pip2 install psychopy didn’t put any binary link from /usr/bin

Is there an invocation like…

python2 -m psychopy.SomethingApp

which I have missed in the documentation somewhere. I couldn’t find anything on the page which details the pip install ( http://psychopy.org/installation.html#manual-install ) which says how to run it after you’ve installed.

Thanks,

Cefn

The answer appears to be running the following to install the missing ‘future’ module (should be listed in psychopy dependencies)…

sudo pip2 install future

Then you can run…

python -m psychopy.app.psychopyApp

You could run this from the Mac OS console, or from CMD, a Terminal or using Alt+F2 on many Linux desktops, for example.

On my Ubuntu Linux machine, for my personal preference of running as a background process and not closing down when I close the terminal window I run the following from the console…

nohup python -m psychopy.app.psychopyApp &

I just completed a reinstall and launch of PsychoPy on a new Ubuntu 17.10 Artful machine, by running these three lines in a console…

pip2 install numpy scipy matplotlib pandas pyopengl pyglet pillow moviepy lxml openpyxl xlrd configobj pyyaml gevent greenlet msgpack-python psutil tables requests[security] pyosf cffi pysoundcard pysoundfile seaborn psychopy_ext python-bidi psychopy pyserial pyparallel egi pytest coverage sphinx future
sudo apt install python-wxgtk3.0
python2 -m psychopy.app.psychopyApp

I would guess these instructions should work fundamentally on any platform, (Windows, Mac), except the installation of wxpython, the Wx widget toolkit (the sudo apt install python-wxgtk3.0 line). You can see https://wiki.wxpython.org/How%20to%20install%20wxPython for instructions to install wxpython on other platforms. Finally pip2 and python2 may be named pip and python on other platforms which don’t (yet) have python3.

The app is simply a Python script that you can launch with

python2 <location_of_psychopy>/app/psychopyApp.py

I don’t know where <location_of_psychopy> is on your machine but you could find that out by doing this from the command line:

python -c 'import psychopy; print(psychopy)'

That will tell you the file name for psychopy.__init__ so just remove the filename at the end to find the right folder

Is there a reason to avoid the module-based invocation? It’s a single line avoiding all the above steps.

Very useful trick to know how to locate python library folders for other purposes, though, so thanks for sharing it.

UPDATE I probably am forgetting that most people the console is a terrifying monster :slight_smile: Hence double-clicking on a script is a better option.

1 Like

Oh, actually that’s a good way to do it, although if you did have psychopy in two locations (e.g. in a developer directory as well as in site-packages then the -m method would confuse them. Hmm, then again python would confuse them too!

thanks, good tip!