Import Error: cannot import name 'gluErrorString' from 'pyglet.gl'

When I import “visual” from “psychopy”, I encountered the error below.
Can somebody help me debug this error?

ImportError: cannot import name 'gluErrorString' from 'pyglet.gl' (/Users/usr/opt/anaconda3/envs/UncannyExperiment2022/lib/python3.8/site-packages/pyglet/gl/__init__.py)

MacOS version12.6
PsychoPy version2022.2.4
I tried to use ‘pip install psychopy’ to install psychopy.

1 Like

We’ve just started seeing this on the automated test suite. It’s due to a change in the most recent version of pyglet (2.0.0). You’ll need to pip install pyglet<2 until we’ve had time to sort out what changes we need to make for compatibility with pyglet 2.0.0.

pyglet 1.5.x should work fine

1 Like

To piggy back on this, here is a quick note on how to install the older version of pyglet (1.5):

  1. Go to the maintenance branch of the GitHub repo for pyglet 1.5 and download the zip file ( GitHub - pyglet/pyglet at pyglet-1.5-maintenance).
  2. run pip install <file path of the downloaded zip folder> in your terminal.
  3. This should uninstall the pyglet 2.0 that comes with the all-in-one psychopy installation and replace it with the older 1.5 version.

Note, there are probably easier ways to accomplish this, but I found this helpful when installing.

P.S. I installed in a virtual environment created within VS code on my Mac.

I tried to install pyglet==1.5.27, problem solved