psychopy.org | Reference | Downloads | Github

Installation on Raspberry Pi 4

I’m trying to install PsychoPy on my Raspberry Pi 4, but keep hitting the same wall both with fresh installations of Raspbian and Ubuntu 20.04. I’m installing in venv.

The trouble starts when installing the dependency PyQt5, when I get the folloiwing message:

Collecting pyqt5
  Using cached PyQt5-5.15.2.tar.gz (3.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /home/nivenlab/Downloads/testenv/bin/python3 /tmp/tmpsx0d945j prepare_metadata_for_build_wheel /tmp/tmpjmtfh6vj
         cwd: /tmp/pip-install-ppar5kbf/pyqt5
    Complete output (31 lines):
    Traceback (most recent call last):
      File "/tmp/tmpsx0d945j", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/tmpsx0d945j", line 280, in <module>
        main()
      File "/tmp/tmpsx0d945j", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/tmp/tmpsx0d945j", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "/tmp/tmpsx0d945j", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
        project = AbstractProject.bootstrap('pep517')
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 479, in setup
        self.apply_user_defaults(tool)
      File "project.py", line 63, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 79, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 225, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-yzq9080v/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/nivenlab/Downloads/testenv/bin/python3 /tmp/tmpsx0d945j prepare_metadata_for_build_wheel /tmp/tmpjmtfh6vj Check the logs for full command output.

As far as I can gather, the important error message is AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'. Stackoverflow and elsewhere tells me that it’s not an atypical error with installation of PyQt5 on both Ubuntu and RPi. Common suggestions include upgrading setuptools and wheel, which I’ve done without luck.

However, I’ve managed to install PyQt5 and still the error persists, as if it’s not recognizing that there is already an installation present. I’ve checked that it’s both present in lib and usr, so it should be universally available.

I’ve also tried installing PyQt5 through pip which gives the same error - only as sudo apt install python3-pyqt5 does it work (in case that could be helpful). I’m very much at a loss now. Has anyone experienced this? I can tell that people have previously managed to install on RPi, but maybe something has changed since then.

A few versions in case it’s helpful:
Pip 20.1.1
PyQt5==5.15.0
Python 3.8.6
virtualenv==20.0.29+ds

Thanks in advance!

I’ve got PsychoPy running on my RPI4 with the latest Raspbian in a venv.

Try installing Qt5 things in Raspbian:

sudo apt install qt5-default pyqt5-dev pyqt5-dev-tools
sudo apt install libgtk-3-dev

Thanks, this helped! I started over with a fresh installation and fresh eyes yesterday and managed. I’ll get a new Pi later this week and try to go through the exact steps on that one and make a short tutorial document in case others would want to use RPi without the struggles. :wink:

For thoose interested in an alternative to PsychoPy to run experiments on RPI3 and 4, the python library ‘RPG’ does a great job in creating and displaying visual gratings at high performance.

About PsychoPy
I have been unable to use it on RPi4 (python3) mostly due, I believe, to a problem with PyQt5.

sudo pip3 install psychopy

Collecting pyqt5
Using cached PyQt5-5.15.4.tar.gz (3.3 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing wheel metadata … /

(endless wheel)

so I have installed all other dependencies one by one, and followed the previous recommendation for PyQt5:

sudo apt install qt5-default pyqt5-dev pyqt5-dev-tools
sudo apt install libgtk-3-dev

python3 psychopyApp.py

The app boot, but immediately crash once I interact with it.
I have the same behavior with running commands from terminal and also with previous version of psychopy on python2.

I would love to see your notes on how you got PsychoPy to work on RPi. I think I’m running into the same wall as others with pyqt5, and it would be great to be able to use it on the pi.