EEG-ExPy icon indicating copy to clipboard operation
EEG-ExPy copied to clipboard

ImportError: Unable to load OpenGL library

Open porwal97 opened this issue 2 years ago • 5 comments

Computer: MacOS Monterey Python Version: 3.7.11 Jupyter Notebook Version: 6.3.0 Brain Interface Used: Cyton+Daisy

I am trying to Test if the Python library installed correctly by using the code:

from eegnb import generate_save_fn from eegnb.devices.eeg import EEG from eegnb.experiments.visual_n170 import n170

I get the following ImportError. Any advice on how to fix this?

ImportError: ('Unable to load OpenGL library', "dlopen(OpenGL, 0x000A): tried: '/opt/anaconda3/envs/eeg-notebooks/lib/OpenGL' (no such file), '/opt/anaconda3/envs/eeg-notebooks/lib/OpenGL' (no such file), '/opt/anaconda3/envs/eeg-notebooks/lib/python3.7/lib-dynload/../../OpenGL' (no such file), '/opt/anaconda3/envs/eeg-notebooks/lib/OpenGL' (no such file), '/opt/anaconda3/envs/eeg-notebooks/bin/../lib/OpenGL' (no such file), 'OpenGL' (no such file), '/usr/local/lib/OpenGL' (no such file), '/usr/lib/OpenGL' (no such file), '/Users/priyanshiporwal/eeg-notebooks/OpenGL' (no such file), '/usr/local/lib/OpenGL' (no such file), '/usr/lib/OpenGL' (no such file)", 'OpenGL', None)

porwal97 avatar Mar 14 '22 21:03 porwal97

Same here, I've been getting the same issue, with the exact same specs as @porwal97. Note: I use an ARM MacBook Air. I've read the main SO article for this error (https://stackoverflow.com/questions/63475461/unable-to-import-opengl-gl-in-python-on-macos) and followed the recommended answer. I've tried changing it to my actual path in my own file system, but nothing.

Zaduk avatar Mar 15 '22 17:03 Zaduk

Hi @porwal97 @Zaduk .

Thanks for the feedback and your interest in eeg-notebooks.

I will try to look into this problem, but unfortunately don't have access to an ARM Mac system for testing.

All of the OpenGL functionality in eeg-notebooks is 'indirect', i.e. it is via Psychopy. I don't see the full stack trace from @porwal97 's Import Error, but I would guess it is a from psychopy import visual, core line. The best help you can get on that issue will be from the Psychopy forum. I recommend post on there the incriminating Psychopy line, plus your OS information.

Definitely keep us posted here on how this goes!

JohnGriffiths avatar Mar 15 '22 17:03 JohnGriffiths

I had the same issue in CI: https://github.com/NeuroTechX/eeg-notebooks/runs/5690930290

I updated PsychoPy to the latest version in https://github.com/NeuroTechX/eeg-notebooks/pull/167, which solved the issue.

Note however that:

  1. In its place there's a new issue, but there's a known workaround: https://github.com/bambocher/pocketsphinx-python/issues/28
  2. You now also need Python >=3.8

ErikBjare avatar Mar 25 '22 16:03 ErikBjare

Commenting here to say that I also have issues with OpenGL on a recent (M1) MacBook Air, I assume it is for similar reasons. So if instructions materialize on how to get it working on this type of machine, I would love to see them.

pjkohler avatar Mar 28 '22 15:03 pjkohler

Update: I installed Xcode and it solved the issue for me. I've won, but at what cost...

Zaduk avatar Apr 05 '22 02:04 Zaduk