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

OpenGL.raw.EGL._errors.EGLError: EGLError( ) #60

Closed
Yuhuoo opened this issue May 20, 2022 · 20 comments
Closed

OpenGL.raw.EGL._errors.EGLError: EGLError( ) #60

Yuhuoo opened this issue May 20, 2022 · 20 comments
Labels
CUDA or OpenGL CUDA related issues Dataset Dataset related issues documentation Improvements or additions to documentation

Comments

@Yuhuoo
Copy link

Yuhuoo commented May 20, 2022

When I run the command of "bash render_batch.sh debug", it gives an error as following

OpenGL.raw.EGL._errors.EGLError: EGLError(
err = EGL_NOT_INITIALIZED,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7f7b3d0ee2c0>,
<importlib._bootstrap.LP_c_int object at 0x7f7b3d0ee440>,
<importlib._bootstrap.LP_c_int object at 0x7f7b3d106bc0>,
),
result = 0
)

How can I fix this?

@YuliangXiu
Copy link
Owner

I updated the dataset.md, the correct command should be bash render_batch.sh debug all.

@Yuhuoo
Copy link
Author

Yuhuoo commented May 20, 2022

I updated the dataset.md, the correct command should be bash render_batch.sh debug all.

Much thanks for your reply. But it doesn't work for me... The error still exits.

@YuliangXiu
Copy link
Owner

According to the error log, it seems that you didn't install EGL, please follow the dataset.md (Environement) to install all the required packages.

@Yuhuoo
Copy link
Author

Yuhuoo commented May 20, 2022

According to the error log, it seems that you didn't install EGL, please follow the dataset.md (Environement) to install all the required packages.

Thanks again for your reply!! But I think I have installed EGL. The info as follows.

(ICON) root@Ib5b57dff600a01084:/hy-tmp# sudo apt-get install freeglut3-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
freeglut3-dev is already the newest version (2.8.1-3).
0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.
(ICON) root@Ib5b57dff600a01084:/hy-tmp# apt install libgl1-mesa-dri libegl1-mesa libgbm1
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgbm1 is already the newest version (21.2.6-0ubuntu0.120.04.2).
libgl1-mesa-dri is already the newest version (21.2.6-0ubuntu0.1
20.04.2).
libegl1-mesa is already the newest version (21.2.6-0ubuntu0.1~20.04.2).
0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.

I have no idea to fix this...5555

@Yuhuoo
Copy link
Author

Yuhuoo commented May 20, 2022

According to the error log, it seems that you didn't install EGL, please follow the dataset.md (Environement) to install all the required packages.

I followed the latest dataset.md (Environement) using " set egl=False and unset PYOPENGL_PLATFORM ",but I still got an error about " freeglut (foo): failed to open display '' "

The complete error info as follows.

(ICON) root@Ib5b57dff600a01084:/hy-tmp/ICON/scripts# bash render_batch.sh debug all
thuman2 START----------
Debug renderer
Rendering thuman2 0300
/hy-tmp/envs/ICON/lib/python3.8/site-packages/numba/np/ufunc/parallel.py:365: NumbaWarning: The TBB threading layer requires TBB version 2019.5 or later i.e., TBB_INTERFACE_VERSION >= 11005. Found TBB_INTERFACE_VERSION = 9100. The TBB threading layer is disabled.
warnings.warn(problem)
OMP: Info #276: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
freeglut (foo): failed to open display ''
thuman2 END----------

@YuliangXiu
Copy link
Owner

freeglut (foo) error often means the program cannot find the screen or you are using clusters without displayer. In such cases, we recommend to use EGL headless mode for rendering. As for the TBB error, never saw this before, don't forget to write down your solution once solved.

@YuliangXiu YuliangXiu added the bug Something isn't working label May 21, 2022
@Yuhuoo
Copy link
Author

Yuhuoo commented May 21, 2022

freeglut (foo) error often means the program cannot find the screen or you are using clusters without displayer. In such cases, we recommend to use EGL headless mode for rendering. As for the TBB error, never saw this before, don't forget to write down your solution once solved.

OK!I will do that when I solved the TBB error. But I still annoyed by the opengl error. I gave up the EGL headless mode, and I used the X11 forwarding to run the script " bash render_batch.sh debug all ", but I still got an error as follows.

OpenGL.error.GLError: GLError(
err = 1282,
description = b'invalid operation',
baseOperation = glTexImage2DMultisample,
cArguments = (
GL_TEXTURE_2D_MULTISAMPLE,
16,
GL_RGBA32F,
512,
512,
GL_TRUE,
)
)

@LT-321
Copy link

LT-321 commented May 21, 2022

When I run the command of "bash render_batch.sh debug", it gives an error as following

OpenGL.raw.EGL._errors.EGLError: EGLError( err = EGL_NOT_INITIALIZED, baseOperation = eglInitialize, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7f7b3d0ee2c0>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d0ee440>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d106bc0>, ), result = 0 )

How can I fix this?

I also encountered the same problem! Whether it's "headless rendering" or not, our mistakes are very similar. That's strange

@Yuhuoo
Copy link
Author

Yuhuoo commented May 21, 2022

Oh! Yeah! I think I have solved the problem. The steps as follows.
1、export PYOPENGL_PLATFORM=egl
2、export MESA_GL_VERSION_OVERRIDE=3.3
3、Change the ms_rate=16 to ms_rate=1.0 in line 115 of render_single.py

But what does the param "ms_rate" mean? If I change the param, will I get the wrong result?

@YuliangXiu
Copy link
Owner

Higher ms_rate is used for Anti-aliasing [1], please look at the face boundary.

image image image
ms_rate=1 ms_rate=16 ms_rate=64

If you change this param, you will get less realistic rendering results, which will harm the trained model. BTW, my PyOpenGL == 3.1.1a1, maybe you could also try the rendering scripts on others' machines.

[1] https://learnopengl.com/Advanced-OpenGL/Anti-Aliasing

@Yuhuoo
Copy link
Author

Yuhuoo commented May 22, 2022

OK! Much thanks for your reply! I checked the GPU on my machine is Tesla V100-SXM2-16GB, and I checked the parameter GL_MAX_SAMPLES is 4, maybe that's why I can't use the ms_rate=16 . Could you tell me which GPU you are using?

@YuliangXiu
Copy link
Owner

I am using Quadro RTX 5000. I don't think ms_rate=4 will affect the final performance a lot.

@Yuhuoo
Copy link
Author

Yuhuoo commented May 23, 2022

TBB error and OMP Info may be just warning refrencing from
numba/numba#6350 (comment)
numba/numba#5275 (comment)

Solutions:
export NUMBA_THREADING_LAYER='omp'
export KMP_WARNINGS='off'

@mmmcn
Copy link

mmmcn commented May 24, 2022

@Yuhuoo Hi, now can you run bash render_batch.sh debug normally? I still got an error after running bash reneder_batch.sh debug :

-> rndr = PRTRender(width=size, height=size, ms_rate=16, egl=egl)
(Pdb) c
Traceback (most recent call last):
  File "./render_single.py", line 125, in <module>
    rndr = PRTRender(width=size, height=size, ms_rate=16, egl=egl)
  File "/home/private/project/3d-holographic-reconstruction/ICON/scripts/./../lib/renderer/gl/prt_render.py", line 35, in __init__
    CamRender.__init__(self,
  File "/home/private/project/3d-holographic-reconstruction/ICON/scripts/./../lib/renderer/gl/cam_render.py", line 32, in __init__
    Render.__init__(self,
  File "/home/private/project/3d-holographic-reconstruction/ICON/scripts/./../lib/renderer/gl/render.py", line 96, in __init__
    glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
  File "/home/private/Software/anaconda3/envs/icon/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 415, in __call__
    return self( *args, **named )
  File "src/errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
	err = 1282,
	description = b'invalid operation',
	baseOperation = glTexImage2DMultisample,
	cArguments = (
		GL_TEXTURE_2D_MULTISAMPLE,
		16,
		GL_RGBA32F,
		512,
		512,
		GL_TRUE,
	)
)

I am not sure if it's the packages' version in python env leads to this, can you share the version of the packages you use?

@Yuhuoo
Copy link
Author

Yuhuoo commented May 24, 2022

You can use ms_rate=4 in line 115 of render_single.py to fix this.

@YuliangXiu YuliangXiu added Dataset Dataset related issues documentation Improvements or additions to documentation and removed bug Something isn't working labels May 26, 2022
@YuliangXiu YuliangXiu added the CUDA or OpenGL CUDA related issues label Jun 17, 2022
@lyk412
Copy link

lyk412 commented Nov 27, 2022

When I run bash scripts/render_batch.sh debug all, I encountered the problem!
How can I solve it?

Traceback (most recent call last):
File "scripts/render_single.py", line 37, in
initialize_GL_context(width=size, height=size, egl=egl)
File "/home/human/lyk/ICON/lib/renderer/gl/init_gl.py", line 23, in initialize_GL_context
create_opengl_context((width, height))
File "/home/human/lyk/ICON/lib/renderer/gl/glcontext.py", line 92, in create_opengl_context
egl.eglInitialize(egl_display, pointer(major), pointer(minor))
File "/home/human/anaconda3/envs/icon/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 402, in call
return self( *args, **named )
File "src/errorchecker.pyx", line 58, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
OpenGL.error.GLError: GLError(
err = 12289,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7fd71cf55bc0>,
<importlib._bootstrap.LP_c_int object at 0x7fd71cf751c0>,
<importlib._bootstrap.LP_c_int object at 0x7fd71cf75040>,
),
result = 0
)

I try
1、export PYOPENGL_PLATFORM=egl
2、export MESA_GL_VERSION_OVERRIDE=3.3
3、Change the ms_rate=16 to ms_rate=1.0 in line 115 of render_single.py
But it doesn't work.

@glorioushonor
Copy link

OK! Much thanks for your reply! I checked the GPU on my machine is Tesla V100-SXM2-16GB, and I checked the parameter GL_MAX_SAMPLES is 4, maybe that's why I can't use the ms_rate=16 . Could you tell me which GPU you are using?

I'm sorry to bother you. I would like to know how to check the parameter GL_MAX_SAMPLES. I tried the code as folows:

import OpenGL.GL as gl
gl_max_samples = gl.glGetIntegerv(gl.GL_MAX_SAMPLES)
print("GL_MAX_SAMPLES =", gl_max_samples)

I get GL_MAX_SAMPLES=0, but when I set the ms_rate=1, the code works. So I wonder if there's something wrong with the way I get the parameters GL_MAX_SAMPLES.

@MalignusCN
Copy link

MalignusCN commented Mar 29, 2023

Oh! Yeah! I think I have solved the problem. The steps as follows. 1、export PYOPENGL_PLATFORM=egl 2、export MESA_GL_VERSION_OVERRIDE=3.3 3、Change the ms_rate=16 to ms_rate=1.0 in line 115 of render_single.py

But what does the param "ms_rate" mean? If I change the param, will I get the wrong result?

When I run the command of "bash render_batch.sh debug", it gives an error as following

OpenGL.raw.EGL._errors.EGLError: EGLError( err = EGL_NOT_INITIALIZED, baseOperation = eglInitialize, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7f7b3d0ee2c0>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d0ee440>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d106bc0>, ), result = 0 )

How can I fix this?

I fix the bug by replace the code from
egl_display = egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY)
to
egl_display = create_initialized_headless_egl_display()
The methods is given in link: shunsukesaito/PIFu#49 (comment) , hope it can help someone

@Dragon2938734
Copy link

sorry , i meet the following problem

multiprocessing.pool.MaybeEncodingError: Error sending result: '<multiprocessing.pool.ExceptionWithTraceback object at 0x7f42f7ad3790>'. Reason: 'ValueError('ctypes objects containing pointers cannot be pickled')'

and follow the historic issues, i reach here ,but i cannot find the "render_batch.sh"

@LarsPh
Copy link

LarsPh commented Feb 6, 2024

Oh! Yeah! I think I have solved the problem. The steps as follows. 1、export PYOPENGL_PLATFORM=egl 2、export MESA_GL_VERSION_OVERRIDE=3.3 3、Change the ms_rate=16 to ms_rate=1.0 in line 115 of render_single.py
But what does the param "ms_rate" mean? If I change the param, will I get the wrong result?

When I run the command of "bash render_batch.sh debug", it gives an error as following
OpenGL.raw.EGL._errors.EGLError: EGLError( err = EGL_NOT_INITIALIZED, baseOperation = eglInitialize, cArguments = ( <OpenGL._opaque.EGLDisplay_pointer object at 0x7f7b3d0ee2c0>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d0ee440>, <importlib._bootstrap.LP_c_int object at 0x7f7b3d106bc0>, ), result = 0 )
How can I fix this?

I fix the bug by replace the code from egl_display = egl.eglGetDisplay(egl.EGL_DEFAULT_DISPLAY) to egl_display = create_initialized_headless_egl_display() The methods is given in link: shunsukesaito/PIFu#49 (comment) , hope it can help someone

This solved the promblem (OpenGL.raw.EGL._errors.EGLError: EGLError( err = EGL_NOT_INITIALIZED...) in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUDA or OpenGL CUDA related issues Dataset Dataset related issues documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

9 participants