psychopy.org | Reference | Downloads | Github

Raspberry Pi - error in pyglet

Hi all,
I’ve been playing around with installing psychopy on the raspberry-pi 4b (running raspbian buster). My goal is to try out the timing test and show some simple stimuli. I am facing errors which leads to a Segmentation fault. I am trying to understand what that is about

My installation:

Issue:
Importing psychopy works fine

from psychopy.visual.window import Window as w  #ok

However, I get a Segmentation fault when I actually open a window:

w() # open a psychopy window results in **Segmentation fault** no error msg

I have been debugging this issue and I have narrowed it down to an error in
Window._setupShaders() called by Window._setupGL() called by Window.__init__().

More specifically, it seems to be failing gltools.linkProgramObjectARB(prog) for a prog value of 55. gltools seems to call pyglet.GL.glLinkProgramARB. I have followed the error to pyglet.

I am curious if anyone else has faced this issue. What could be the cause of the error?

Thanks for your time

@balajisriram I’m experiencing the exact same issue, but with PsychoPy (v2020.1.2). Using GUI dialogs works fine, but rendering a Window fails with a ‘Segmentation fault’ message and no error code.

I did fix it though. Try rolling back PsychoPy to v3.2.4 using the command:

python3 -m pip install psychopy==3.2.4

I was able to render Windows once I did that. I also uninstalled pygame, though I don’t think that influenced this.

Let me know if that fixes your issue!

Thank for the post. I’m actually looking into getting PsychoPy better supported on the Raspberry Pi 4. There is a bit of blind spot in development since work on the graphics system is usually tested on Nvidia, AMD, and Intel hardware. Since the RPi4 is looking like a suitable desktop replacement with good GPU support, I’m going to ensure PsychoPy is compatible with it in the future.

1 Like

Thanks - I’ll keep my eyes peeled for any updates on this front. Glad to help write/test out code as and when that may be necessary

I haven’t tried earlier versions - thanks. I’ll give it a try soon

The fact it worked before in previous versions was a “happy accident” since the RPi OpenGL driver was limited to OpenGL 2.0. I’ve been moving things over to newer OpenGL specs since stuff has been breaking on Intel cards which a large majority of users have. I’ll try to keep compatibility going with OpenGL versions the RPi supports in the future, possibly by detecting the platform and selecting a code path.

Having PsychoPy on the RPi is something I personally want supported since an experiment can directly access the GPIO giving near real time triggering and event callbacks without the need for a separate device.

1 Like

Hey mdc. Any update? Our lab are considering an independent visual stimulation system for mice controlled using GPIO commands to a rasp pi 4 and a screen. I was wondering if we connect an external lcd on the pi, would we be in theory, able to control the screen using psychopy?

Thanks for your interest anas-masood. mdc, is this a feature that is undergoing any development? do you have a sense of how to support psychopy on r-pi? If you already have a strategy in mind, I don’t mind working through the coding to enable support.