PsychoPy3 on Linux installation issues (solved)

After having a few issues with installing PsychoPy3 on Linux (Linux Mint 19.1), below, I listed the necessary steps to get it running. Maybe, some of the issues can be resolved with updates or by including them in the online instructions (Thanks Claire, for the final ffmpeg hint).

Step 1: (not documented online)

sudo apt-get install python3-pip
sudo pip3 install setuptools

Step 2: As instructed online (but with pip3 – and excluding iolabs). Just using pip might lead to using Python2 instead of Python3.

sudo pip3 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 pip3 install pyserial pyparallel egi   # including 'iolabs' results in an error (Jan 2019)
sudo pip3 install pytest coverage sphinx

Additional (not documented) step 3

# installing wxpython with pip (sudo pip3 install wxpython)
# would get a newer version but resulted in errors
sudo apt-get install python3-wxgtk4.0

# 'Webview' part of wxpython missing:
sudo apt-get install python3-wxgtk-webview4.0

# Missing 'ffmpeg' results in crash shortly after startup, thus:
sudo apt-get install ffmpeg

Now it should start with:

psychopyApp.py

A new Debian version will be released in a few months (April 2019). I’ll test this on the new Debian again. If it is working there, then it should also work on all its descendants (Ubuntu, Mint, etc.).

1 Like

The second to last problem ( No module named ‘wx.html2’ ) is solved by installing the ‘webview’ part of wx

sudo apt-get install python3-wxgtk-webview4.0

Thus wx.html2 works. However, the last problem remains: crash after a few seconds/clicks.
(I updated the respective part in the initial post.)
Torsten

Hello,
I was having the same kind of trouble installing Psychopy 3 on Ubuntu 18.10.
What I did was to make sure that the default python was indeed python 3 (running sudo ln -sfn /usr/bin/python3 /usr/bin/python). Then I followed more or less the same steps as you did and ended up with the same problem of Psychopy crashing after a few seconds.
However I noticed from the output window of the Coder view that Psychopy was trying to install the missing ffmpeg package just before crashing. So I installed it directly from outside Psychopy (sudo apt-get install ffmpeg) and it is now working like a charm.
So maybe have a look at the Coder view to see if you don’t run into the same problem ?

Claire

1 Like

Awesome. Thank you Claire!
I can confirm this. I did not even see that the Coder view was open behind the Builder (before it crashed). But after knowing what to look for, I could catch a glimpse of something “ffmpeg” in the Coder output window. After install ffmpeg there was no immediate crash anymore and everything seems to work fine.
Torsten

ps: I updated the initial post to be as informative as possible as to what steps are necessary and what is documented an what not. I hope this helps others and/or helps resolving some of the missing dependencies.

Re: wx, did you try installing from the wheels on wxpython.org? For Mint 19.1, I think it would end up being

pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ wxPython

(instructions here: https://wxpython.org/pages/downloads/index.html)

Are you being able to use pavlovia?
I am facing issues (Pavlovia not loading) on fedora and Ubuntu…

After some time, a new issue showed up when installing PsychoPy3 "Requirement.parse(“cryptography>=…), set([‘PyOpenSSL’])”
This was solved by

pip3 install pyopenssl

I followed the steps (on Ubuntu 18.04), but at the end when I type in psychopyApp.py, the command line returns: command not found…Anyone know why?

Were you ever able to resolve this? I got the same error after installing it :frowning:

Sorry that this hasn’t been easier. I’m afraid the core team developing PsychoPy is very small and busy!

That said, I just tried to install on a VM running a clean install of Ubuntu 20.04 and this appears to work:

sudo apt-get install psychopy   # fetches outdated version from debian
sudo apt-get install python3-pip python3-wxgtk-webview4.0 
# update to latest psychopy:
pip3 install -U psychopy  
 # fix some incompatible lib versions:
pip3 install cffi==1.14.0 psychtoolbox==3.0.16 

Those 4 lines should be enough that you can now start PsychoPy and edit experiments!

To get psychtoolbox working for keyboard use you also need the following steps to raise the priority of the experiment process:

sudo groupadd --force psychtoolbox
sudo usermod -a -G psychtoolbox $USER

then do sudo nano /etc/security/limits.d/99-psychopylimits.conf and copy/paste in the following text to that file:

@psychtoolbox   -  nice       -20
@psychtoolbox   -  rtprio     50
@psychtoolbox   -  memlock    unlimited
1 Like

Hi Jon,

I’m trying to use the DotStim, and when I try this installation followed by from psychopy.visual import DotStim, I receive a ModuleNotFoundError: No module named 'wx' error. Right now I’m trying to install wx with pip install wxPython but the process has been spinning for the past 15 minutes

$ pip install wxpython
Collecting wxpython
  Using cached wxPython-4.1.1.tar.gz (66.0 MB)
Requirement already satisfied: pillow in ./mac_venv/lib/python3.6/site-packages (from wxpython) (8.3.2)
Requirement already satisfied: six in ./mac_venv/lib/python3.6/site-packages (from wxpython) (1.16.0)
Requirement already satisfied: numpy in ./mac_venv/lib/python3.6/site-packages (from wxpython) (1.19.5)
Building wheels for collected packages: wxpython
  Building wheel for wxpython (setup.py) ... |

Is this supposed to happen? Is something going wrong?

Hi @RylanSchaeffer

I installed PsychoPy on Ubuntu 20.04 using a slightly different set of steps and I can’t replicate what you described.

I’m going to leave the installation process I’ve used below, in case you want to give it a try:

Install outdated psychopy from Ubuntu’s repository
sudo apt install psychopy

Install pip3
sudo apt install python3-pip

Download the lastest wxPython-4 from
Index of /wxPython4/extras/linux/gtk3/ubuntu-20.04

Install the downloaded wxPython-4 file
pip3 install <path_to_wxPython4_downloaded_file>
In my case: pip3 install /home/flavio/Downloads/wxPython-4.1.1-cp38-cp38-linux_x86_64.whl

Install Psychtoolbox bindings
sudo apt install libusb-1.0-0-dev portaudio19-dev libasound2-dev

Update psychopy using pip3
pip3 install -U psychopy

Upgrade cryptography - only incompatibility I spotted during the installation
pip3 install --upgrade cryptography

Then, I’ve finished the process with the psychtoolbox part described by @jon above:

And if you are using Builder, you might want to check this out.

Cheers!
Flavio

This fails to make a difference on my most recent installation of Ubuntu.
The error pops up:

pkg_resources.DistributionNotFound: The 'google-cloud' distribution was not found and is required by PsychoPy

Hi @Jaden_Lorenc

Please, take a look at this instructions.
I hope it helps :wink:

I am trying to run PsychoPy 3 on Xubuntu 22.04. I wonder if I should follow this same steps? I get an error about the wheel.

Thanks!

Hi @bobuch

This one is a bit outdated.
But I’ve recently updated this tutorial on how to install PsychoPy 2022.2.4 on Ubuntu 22.04.

I don’t see why it would be any different in Xubuntu.
It might differ, however, concerning specifics (e.g. playing movies).

Please, let me know if it helps.

Best regards

Dear Flavio,

Thank you so much!!

R

Dear Flavio,

Many thanks!!

Roberto