Problems with Big Sur running PsychoPy v1.90.2

Eek. So I have some people doing a longitudinal training study (which is covering a significant period of time) that I created in PsychoPy v1.90.2 (I know, I know - this is ancient now…). Someone’s just updated their OS to Big Sur and they’re now receiving the following error message:

Traceback (most recent call last):
File “/Users/username/Music/Current/Study/Experimentfolder/”, line 2, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging
File “/Applications/ init .py”, line 26, in
from .text import TextStim
File “/Applications/”, line 28, in
import psychopy.event
File “/Applications/”, line 63, in
from pyglet.window.mouse import LEFT, MIDDLE, RIGHT
File “/Applications/ init .py”, line 1896, in
File “/Applications/ init .py”, line 384, in getattr
import (import_name)
File “/Applications/ init .py”, line 100, in
from import GLException
File “/Applications/”, line 141, in
from import link_GL, link_GLU, link_AGL
File “/Applications/”, line 49, in
File “/Applications/”, line 118, in load_library
return self.load_framework(kwargs[‘framework’])
File “/Applications/”, line 286, in load_framework
raise ImportError(“Can’t find framework %s.” % path)
ImportError: Can’t find framework /System/Library/Frameworks/OpenGL.framework.

As mentioned in this thread, the issue seems to be with Pyglet and OpenGL. Can anyone recommend a potential way to fix this in such an old version of PsychoPy?

Using this approach as a guide, I can find (both attached):

/Applications/ init .py

But I’m not sure what the equivalent file for ‘visual/textbox2/’ would be? The textbox folder (there isn’t a textbox2 folder) contains only:

init .py

Also, psychopy/visual/ has very similar code to that in Jon’s example, whereas
visual/textbox/ is quite different:

import math
import numpy as np
import unicodedata as ud
from matplotlib import font_manager
from psychopy.core import getTime
from .textureatlas import TextureAtlas
from import (glGenLists, glNewList, GL_COMPILE, GL_QUADS,
glBegin, glTexCoord2f, glVertex2f, glEnd, glDeleteLists,
glEndList, glTranslatef, glDeleteTextures)

If this is indeed an approach worth exploring, what edits would you suggest I make to the PsychoPy files to fix this issue? Here are the files themselves: (18.9 KB) init .py|attachment (2.7 KB)

If anyone can help with this it would be greatly appreciated? I’ve already lost one participant, and I suspect I’ll be losing more as people update their systems…

Thanks (a lot) in advance!

I don’t know for sure if this will work, but the latest version of PsychoPy (incorporating updates to support Big Sur) still supports running experiments while emulating version 1.90.2.

Try asking one of the affected people to download the latest version, then click the experiment settings icon in the toolbar and choose 1.90.2 in the “Use version” dropdown menu (it won’t necessarily be in obvious numerical order). They will need to save the changed Builder file.

You might have already told PsychoPy to use that version of course. If so, that setting is baked in and they could just run it as normal.

Note that the very first time you run an experiment specifying an older version, PsychoPy will need to download the corresponding code files for that version. This is all done using the magic of git, invisible to the user. But there might be a longer than normal delay before the experiment starts on that first run, and internet access will need to be available.

1 Like

Awesome, thanks Michael - I’ll try that!

Hi @Michael

Rereading this, I should add that the experiment is written in code rather than using the builder. Looking at the coder view in the most recent PsychoPy, there doesn’t seem to be a settings option? Am I to take it that it can’t open .py files in an older version of PsychoPy?

And if so, I don’t suppose you have any other suggestions?

Thanks! :slight_smile:

Hi @jon

Happy New Year, and thanks again for creating PsychoPy, which has helped my research no end. My utmost gratitude!

@Michael has helpfully pointed out that the most recent incarnation is able to emulate previous versions of PsychoPy. For someone, such as myself, that is using PsychoPy (as downloaded on participants’ own computers) to collect data over an extended period of time, this is a very useful function indeed. The only downside that I can see is that (from what I can tell at least) it can only do this for experiments built using the builder. Perhaps this would be overly complicated for one reason or another, so apologies if this a ridiculous question, but would it be feasible to include previous version emulation that can read .py files?

Thanks again!

[EDIT: Looks like I was in error asking this (sorry), although a further issue has arisen since with audioLib… see below]

All Builder does is generate a Python script. So anything Builder can do, your own scripts can achieve as well:

1 Like

Thanks a million (with apologies for being slow). I’ll try that then!

So I’ve set it up with:

from psychopy import prefs
prefs.hardware[‘audioLib’] = [‘pygame’,‘pyo’]

and I’m getting this error:

File “/Users/sam115/Downloads/experiment_folder/”, line 4, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging
File “/Users/sam115/.psychopy3/versions/psychopy/sound/”, line 70, in
for thisLibName in prefs.general[‘audioLib’]:
File “configobj.pyc”, line 554, in getitem
KeyError: ‘audioLib’

Am I correct in thinking that means it doesn’t like pygame? Pygame is pretty essential to the experiment unfortunately, as I use it to play lots and lots of MIDI files. It looks as though this might be a fix? If so, then how would you paraphrase “installing it to another python3 installation on your system and then pointing PsychoPy preference for additional libs to include that folder” in the most idiot-friendly way possible?

Thanks again :slight_smile:

The error is about the dictionary key ('audioLib'), not the value. i.e. it doesn’t look like the preferences have an entry for that key.

1 Like

That’s odd as I’ve set it both manually in preferences (to pygame and pyo) and in the code itself:

from psychopy import prefs
prefs.hardware[‘audioLib’] = [‘pygame’,‘pyo’]

Or is this to say that the PsychoPy preferences themselves have this fault?

Any ideas?

1.90.1 is definitely incompatible with Big Sur. To make it run requires several changes within the psychopy app:

  1. Updating to a new version of pyglet within the application
  2. Updating the code of PsychoPy libs to make sure they avoid using the pyOpenGL lib (which has not been fixed for Big Sur). In the 2020.1 release that meant alterations to TextBox2 and TextBox but I can’t tell you where else the issues will crop up in the 1.90 release and I’m afraid I’m not willing to go back and debug that.

If you’re expecting your participants to do this on their own machines I think that will bring its own headaches. I think you’d be better off upgrading your script to work with the new version of PsychoPy rather than trying to back-port recent fixes to outdated PsychoPy.

I see you’ve asked the specific question about audioLib elsewhere so I’ll answer that there

1 Like

Regarding whether useVersion can help, useVersion(‘1.90.2’) with a new installation:

  • will mean that the pyglet dependency will be a newer one (fixing issue #1 above)
  • the code within the textbox, and other stimuls libs, will be exactly as it was in 1.90.2 and will not benefit from recent fixes so I don’t think the solution will fix that side of things
1 Like

Ah, so this to say the emulate older versions function essentially won’t work on Big Sur anyway? Damnit. It seems to causing lots of musicians problems with their recording/production software too. Big Sur seems thus far to a Big Pain in the Ass!

Thanks for your help, as ever :slight_smile:

I’ve found that ‘pyOpenGL’ appears in the following v1.90.2 files:


Could I in theory go and replace every instance of

import OpenGL.GL as gl


from pyglet import gl

Or am I being overly ambitious (given my rudimentary skillset)?