How to install PsychoPy on Ubuntu 21.10

Hi everyone,

I’ve successfully installed PsychoPy 2022.1.1 on Ubuntu 21.10.
Since there was substantial differences in the process, compared to PsychoPy 2021.2.3, here is how I did it.

First, install outdated psychopy from Ubuntu’s repository

sudo apt install psychopy

Now, install pip3, some Psychtoolbox bidings and packages needed to compile wxPython and some Psychopy dependencies (as pocketsphinx, for instance):

sudo apt install python3-pip make gcc libgtk-3-dev libgstreamer-gl1.0-0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras python-dev bison autoconf libtool-bin swig libpulse-dev libusb-1.0-0-dev portaudio19-dev libasound2-dev freeglut3 freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libjpeg-dev libnotify-dev libsdl2-dev libsm-dev libtiff-dev libwebkit2gtk-4.0-dev libxtst-dev

Two dependencies are not installed automatically and are needed to compile wxPython and run PsychoPy when the installation is finished. To get rid of them run:

pip3 install testresources pyosf

Now, to download and compile/build your wxPython, ask pip3 to force reinstall, otherwise, it is going to use the xwPython version from Ubuntu’s repository (which won’t work - at least, not for me). This is going to take a while… So, paste the line below into the Terminal, press enter and go have some coffee :wink:

pip3 install -v --user --no-cache-dir --force-reinstall wxPython

Update psychopy using pip3

pip3 install -U psychopy

Raise the priority of the experiment process

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

Create a 99-psychopylimits.conf file using gedit:

sudo gedit /etc/security/limits.d/99-psychopylimits.conf

Paste in the following text to that file and save it:

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

If you get an error while trying to save your experiment using Builder, an outdated defusedxml might be the culprit. Just update it with:

pip3 install -U defusedxml

In this new version, Builder does not crash anymore when you insert a $ into a textbox (Hurray!).

Now, you are good to go :wink:
Have fun using PsychoPy 2022.1.1 in Ubuntu 21.10!

2 Likes