psychopy.org | Reference | Downloads | Github

ImportError: No module named OpenGL.arrays

Hi.

I’m trying to run a protocol that uses the Warper class of psychopy.visual.windowwarp on Windows installations of PsychoPy v1.8.2. The corresponding file contains the import “from OpenGL.arrays import ArrayDatatype as ADT” which fails due to this missing dependency.

The machines in question are Dell stationary computers w. Windows 10, and Intel HD Graphics 350 graphics cards of some variety. PsychoPy was installed using the standard Windows installer.

Does anyone know why this happens, for example, does the installer check for a working, OpenGL-compliant graphics card before copying certain files? I thought the installer would provide a self-contained Python environment with all submodules in place.

Ah, it’s conceivable that PyOpenGL was omitted: it isn’t normally needed because pyglet contains its own opengl lib but it looks like the contributor of this (it wasn’t written by me) has used PyOpenGL for it.

Your options:

  • you work out how to convert the code in windowwarp.py to use pyglet instead. You’ll need to find all occurrences of ADT. and replace them with some equivalent function. (And let us know how you get on :slight_smile: )
  • you install pyopengl into your own copy of python and then copy it over to your psychopy installation
  • you wait for the next release (where I’ll check why the win installer doesn’t have pyopengl installed)

Hi, thanks for the response.
Did some testing on a Windows 10 virtual machine and may have found a working solution. I installed the Microsoft Visual C++ Compiler for Python 2.7 from http://aka.ms/vcpython27. Then, I went to the folder <PsychoPy2 install dir>\Lib\site-packages\ using the Command Promp, and installed the PyOpenGL modules with the provided pip as

python pip install PyOpenGL PyOpenGL_accelerate --user

Then:
python -c "from OpenGL.arrays import ADT
seems ok

I will have to test this on the actual desktops tomorrow. But, in the end, packaging also PyOpenGL would be great for future releases. I’m not sure if it is feasible to replace ADT with something else.