# Raspberry Pi - error in pyglet

**URL:** <https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025>\
**Category:** Coding\
**Tags:** installation\
**Created:** [February 16, 2020, 8:24pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025 "2020-02-16T20:24:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![balajisriram](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/balajisriram/32/1502_2.png) [@balajisriram](https://discourse.psychopy.org/u/balajisriram)\
**Post date:** [February 16, 2020, 8:24pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/1 "2020-02-16T20:24:53Z")

</div>

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:

- raspberry pi 4b with raspbian buster
- updated to latest software
- installed psychopy [see [https://github.com/balajisriram/BCore/blob/raspberry/setup\_pi.sh](https://github.com/balajisriram/BCore/blob/raspberry/setup_pi.sh) I manually installed the dependencies for psychopy and then pip installed psychopy (v 2020.1.0) ]

Issue:  
Importing psychopy works fine

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

```

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

```auto
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

---

<div class="post-metadata">

**Author:** ![wsarce](https://avatars.discourse-cdn.com/v4/letter/w/6de8d8/32.png) [@wsarce](https://discourse.psychopy.org/u/wsarce)\
**Post date:** [May 12, 2020, 6:00pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/2 "2020-05-12T18:00:02Z")

</div>

@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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![mdc](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/mdc/32/3409_2.png) [@mdc](https://discourse.psychopy.org/u/mdc)\
**Post date:** [May 26, 2020, 5:48am UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/3 "2020-05-26T05:48:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![balajisriram](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/balajisriram/32/1502_2.png) [@balajisriram](https://discourse.psychopy.org/u/balajisriram)\
**Post date:** [May 26, 2020, 11:54am UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/4 "2020-05-26T11:54:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![balajisriram](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/balajisriram/32/1502_2.png) [@balajisriram](https://discourse.psychopy.org/u/balajisriram)\
**Post date:** [May 26, 2020, 11:54am UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/5 "2020-05-26T11:54:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mdc](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/mdc/32/3409_2.png) [@mdc](https://discourse.psychopy.org/u/mdc)\
**Post date:** [May 26, 2020, 2:32pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/6 "2020-05-26T14:32:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anas-masood](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@anas-masood](https://discourse.psychopy.org/u/anas-masood)\
**Post date:** [October 1, 2020, 4:52pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/7 "2020-10-01T16:52:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![balajisriram](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/balajisriram/32/1502_2.png) [@balajisriram](https://discourse.psychopy.org/u/balajisriram)\
**Post date:** [October 1, 2020, 8:10pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/8 "2020-10-01T20:10:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![biol75](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/biol75/32/12857_2.png) [@biol75](https://discourse.psychopy.org/u/biol75)\
**Post date:** [November 20, 2023, 4:20pm UTC](https://discourse.psychopy.org/t/raspberry-pi-error-in-pyglet/11025/9 "2023-11-20T16:20:06Z")

</div>

Thank you, this also worked for me
