Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unable to load EGL library #101

Open
mayoudong1993 opened this issue Jul 5, 2020 · 16 comments
Open

[BUG] Unable to load EGL library #101

mayoudong1993 opened this issue Jul 5, 2020 · 16 comments
Labels
bug Something isn't working

Comments

@mayoudong1993
Copy link

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 mayoudong1993 added the bug Something isn't working label Jul 5, 2020
@mkocabas
Copy link
Owner

mkocabas commented Jul 6, 2020

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.

@polar99
Copy link

polar99 commented Jul 27, 2020

@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)

@mkocabas
Copy link
Owner

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

@polar99
Copy link

polar99 commented Aug 3, 2020

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.

@AngioC
Copy link

AngioC commented Oct 14, 2020

@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.

@elk-april
Copy link

@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.....

@emepetres
Copy link

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

@sklipnoty
Copy link

@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.

@bravewhh
Copy link

@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!

@Mapleaf-Lau
Copy link

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.

@stevejaehyeok
Copy link

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

@wwwpkol
Copy link

wwwpkol commented Feb 25, 2023

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

@lidonghaoharry
Copy link

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!

@HYJ-EIS
Copy link

HYJ-EIS commented Mar 26, 2024

@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.

@nitinmukesh
Copy link

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

@yangxiaoleyxl
Copy link

yangxiaoleyxl commented Jun 27, 2024

Traceback (most recent call last):
File "inference.py", line 188, in
main()
File "inference.py", line 57, in main
from utils.vis import render_mesh, save_obj
File "/Volumes/Work/Chinese_CV/CCM/Papers/SMPLer-X/main/../common/utils/vis.py", line 9, in
import pyrender
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/pyrender/init.py", line 3, in
from .light import Light, PointLight, DirectionalLight, SpotLight
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/pyrender/light.py", line 10, in
from OpenGL.GL import *
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/GL/init.py", line 3, in
from OpenGL import error as _error
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/error.py", line 12, in
from OpenGL import platform, _configflags
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/init.py", line 35, in
_load()
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/init.py", line 32, in _load
plugin.install(globals())
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 92, in install
namespace[ name ] = getattr(self,name,None)
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 14, in get
value = self.fget( obj )
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/egl.py", line 93, in GetCurrentContext
return self.EGL.eglGetCurrentContext
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 14, in get
value = self.fget( obj )
File "/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/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', "dlopen(EGL, 0x000A): tried: 'EGL' (no such file), '/System/Volumes/Preboot/Cryptexes/OSEGL' (no such file), '/Volumes/Work/Anaconda/anaconda3/envs/smplerx/lib/python3.8/lib-dynload/../../EGL' (no such file), '/Volumes/Work/Anaconda/anaconda3/envs/smplerx/bin/../lib/EGL' (no such file), '/usr/lib/EGL' (no such file, not in dyld cache), 'EGL' (no such file), '/usr/local/lib/EGL' (no such file), '/usr/lib/EGL' (no such file, not in dyld cache)", 'EGL', None)

  • ffmpeg -y -f image2 -r 24 -i /Volumes/Work/Chinese_CV/CCM/Papers/SMPLer-X/demo/results/test_video/img/%06d.jpg -vcodec mjpeg -qscale 0 -pix_fmt yuv420p /Volumes/Work/Chinese_CV/CCM/Papers/SMPLer-X/demo/results/test_video.mp4
    ffmpeg version 7.0.1 Copyright (c) 2000-2024 the FFmpeg developers
    built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
    configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
    libavutil 59. 8.100 / 59. 8.100
    libavcodec 61. 3.100 / 61. 3.100
    libavformat 61. 1.100 / 61. 1.100
    libavdevice 61. 1.100 / 61. 1.100
    libavfilter 10. 1.100 / 10. 1.100
    libswscale 8. 1.100 / 8. 1.100
    libswresample 5. 1.100 / 5. 1.100
    libpostproc 58. 1.100 / 58. 1.100
    [image2 @ 0x13b91ff20] Could find no file with path '/Volumes/Work/Chinese_CV/CCM/Papers/SMPLer-X/demo/results/test_video/img/%06d.jpg' and index in the range 0-4
    [in#0 @ 0x13b91e7c0] Error opening input: No such file or directory
    Error opening input file /Volumes/Work/Chinese_CV/CCM/Papers/SMPLer-X/demo/results/test_video/img/%06d.jpg.
    Error opening input files: No such file or directory

Hi, I meet the same error when running slurm_inference.sh of https://github.com/caizhongang/SMPLer-X.
Could any one give a solution ? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests