VIBE icon indicating copy to clipboard operation
VIBE copied to clipboard

[BUG] Unable to load EGL library

Open mayoudong1993 opened this issue 5 years ago • 16 comments
trafficstars

My operation system is Windows 10, and my GPU driver is GeForce Game Ready Driver. I got this error below, could you give me some hints, what's this error talking about?

Traceback (most recent call last): File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\egl.py", line 70, in EGL mode=ctypes.RTLD_GLOBAL File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\ctypesloader.py", line 45, in loadLibrary return dllType( name, mode ) File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\ctypes_init_.py", line 364, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 126] 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/projects/pycharm/VIBE/demo.py", line 33, in from lib.utils.renderer import Renderer File "C:\projects\pycharm\VIBE\lib\utils\renderer.py", line 19, in import pyrender File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\pyrender_init_.py", line 3, in from .light import Light, PointLight, DirectionalLight, SpotLight File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\pyrender\light.py", line 11, in from .texture import Texture File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\pyrender\texture.py", line 8, in from OpenGL.GL import * File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\GL_init_.py", line 3, in from OpenGL import error as _error File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\error.py", line 12, in from OpenGL import platform, configflags File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform_init.py", line 35, in load() File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform_init.py", line 32, in _load plugin.install(globals()) File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\baseplatform.py", line 92, in install namespace[ name ] = getattr(self,name,None) File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\baseplatform.py", line 14, in get value = self.fget( obj ) File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\egl.py", line 93, in GetCurrentContext return self.EGL.eglGetCurrentContext File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\baseplatform.py", line 14, in get value = self.fget( obj ) File "C:\Users\youdo\anaconda3\envs\vibe-env\lib\site-packages\OpenGL\platform\egl.py", line 73, in EGL raise ImportError("Unable to load EGL library", *err.args) ImportError: ('Unable to load EGL library', 22, '找不到指定的模块。', None, 126, None, 'EGL', None)

mayoudong1993 avatar Jul 05 '20 18:07 mayoudong1993

Hi @mayoudong1993,

We didn't test our code on Windows, so it is a bit difficult to figure out the problem. And it seems the problem is related to pyrender installation, so I would suggest you to refer pyrender docs/issues to find a solution.

mkocabas avatar Jul 06 '20 15:07 mkocabas

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem raise ImportError("Unable to load EGL library", *err.args) occured.

(1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library.

(2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py.
It works well on my experiment. (Win10 64 bit)

polar99 avatar Jul 27 '20 07:07 polar99

Thanks @StephenGreat for the solution. Is this the only modification you did to make VIBE work on Windows?

mkocabas avatar Jul 31 '20 09:07 mkocabas

Thanks @StephenGreat for the solution. Is this the only modification you did to make VIBE work on Windows?

You need to install ffmpeg (windows latest version) which can download from official website. Put ffmpeg.exe in system variable Path. Other settings are same as requirements.txt https://github.com/mkocabas/VIBE/blob/master/requirements.txt Any questions are welcome.

polar99 avatar Aug 03 '20 00:08 polar99

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem raise ImportError("Unable to load EGL library", *err.args) occured.

(1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library.

(2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It works well on my experiment. (Win10 64 bit)

After commenting this line I got this error: "ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Cannot connect to "None"". I'm trying to render the results on a ubuntu server.

AngioC avatar Oct 14 '20 15:10 AngioC

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem raise ImportError("Unable to load EGL library", *err.args) occured. (1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library. (2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It works well on my experiment. (Win10 64 bit)

After commenting this line I got this error: "ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Cannot connect to "None"". I'm trying to render the results on a ubuntu server.

Hi, have you solved it? I meet it too.....

elk-april avatar Dec 16 '20 09:12 elk-april

Hi, # apt-get install libosmesa6-dev freeglut3-dev fixes the issue.

emepetres avatar Feb 04 '21 15:02 emepetres

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem raise ImportError("Unable to load EGL library", *err.args) occured. (1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library. (2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It works well on my experiment. (Win10 64 bit)

After commenting this line I got this error: "ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Cannot connect to "None"". I'm trying to render the results on a ubuntu server.

Hi, have you solved it? I meet it too.....

I would also be interested in a solution specifically for windows 10 and python 3.7.

sklipnoty avatar Feb 23 '21 10:02 sklipnoty

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem raise ImportError("Unable to load EGL library", *err.args) occured. (1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library. (2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It works well on my experiment. (Win10 64 bit)

After commenting this line I got this error: "ValueError: Failed to initialize Pyglet window with an OpenGL >= 3+ context. If you're logged in via SSH, ensure that you're running your script with vglrun (i.e. VirtualGL). The internal error message was "Cannot connect to "None"". I'm trying to render the results on a ubuntu server.

Hi, have you solved it? I meet it too.....

I would also be interested in a solution specifically for windows 10 and python 3.7.

have you solved this problem?please contact me with qq:1305966853,thank you very much!

bravewhh avatar May 19 '21 09:05 bravewhh

comment os.environ['PYOPENGL_PLATFORM'] = 'egl' is effective, but it doesn't seem to be the main reason. I fixed it by install pyglet==1.5.24. And 1.5.20 or newer 2.0.0 all have error of no GLU or Unable to load EGL.

Mapleaf-Lau avatar Nov 12 '22 13:11 Mapleaf-Lau

sudo apt-get install libglfw3-dev libgles2-mesa-dev This saved my life

stevejaehyeok avatar Nov 18 '22 08:11 stevejaehyeok

Thanks @StephenGreat for the solution. Is this the only modification you did to make VIBE work on Windows?

You need to install ffmpeg (windows latest version) which can download from official website. Put ffmpeg.exe in system variable Path. Other settings are same as requirements.txt https://github.com/mkocabas/VIBE/blob/master/requirements.txt Any questions are welcome.

I have installed ffmpeg.exe, and passed the CMD test, but there is still an ImportError: ('Unable to load EGL library', "Could not find module 'EGL' (or one of its dependencies). Try using the full path with constructor syntax.", 'EGL', None) I am using the script from https://github.com/eth-siplab/AvatarPoser thanks for your help

wwwpkol avatar Feb 25 '23 06:02 wwwpkol

comment os.environ['PYOPENGL_PLATFORM'] = 'egl' is effective, but it doesn't seem to be the main reason. I fixed it by install pyglet==1.5.24. And 1.5.20 or newer 2.0.0 all have error of no GLU or Unable to load EGL.

Hi, may I ask how you installed pyglet==1.5.24? I tried downloading it using the source code zip folder, but it still has the same GLUE and EGL issues. Thanks!

lidonghaoharry avatar Oct 30 '23 23:10 lidonghaoharry

@mkocabas @mayoudong1993 This problem should not be from pyrender. The biggest problem is the code : os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It will use EGL as OpenGL Platform. So when initializing opengl, the problem occured.raise ImportError("Unable to load EGL library", *err.args)

(1) About EGL on Windows system In fact, there is nothing like egl.dll in python\Lib\site-packages\OpenGL\DLLS, so it can't load EGL library.

(2) As for pyrender Pyrender\offscreen.py

def _create(self):
     if 'PYOPENGL_PLATFORM' not in os.environ:
         from pyrender.platforms.pyglet_platform import PygletPlatform
         self._platform = PygletPlatform(self.viewport_width,
                                         self.viewport_height)
     elif os.environ['PYOPENGL_PLATFORM'] == 'egl':
         from pyrender.platforms import egl
         device_id = int(os.environ.get('EGL_DEVICE_ID', '0'))
         egl_device = egl.get_device_by_index(device_id)
         self._platform = egl.EGLPlatform(self.viewport_width,
                                          self.viewport_height,
                                          device=egl_device)

The default is PygletPlatform. So just comment os.environ['PYOPENGL_PLATFORM'] = 'egl' in demo.py. It works well on my experiment. (Win10 64 bit)

After commenting this line,the error ImportError: ('Unable to load EGL library', 22, '找不到指定的模块。', None, 126, None, 'EGL', None) remain the same,this solution doesn't work.

I would also be interested in a solution specifically for windows 10 and python 3.7.

HYJ-EIS avatar Mar 26 '24 06:03 HYJ-EIS

I am also stuck becuase of EGL issue. Anyone have any idea how to fix this on Windows 11.

nitinmukesh avatar Apr 04 '24 18:04 nitinmukesh