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

module 'pyglet.gl' has no attribute 'xlib' #13

Open
hearables-pkinsella opened this issue Jun 16, 2020 · 6 comments
Open

module 'pyglet.gl' has no attribute 'xlib' #13

hearables-pkinsella opened this issue Jun 16, 2020 · 6 comments

Comments

@hearables-pkinsella
Copy link

Can you post the python version and version for the dependencies you use?

I am getting a pyglet xlib error running on Mac in python 3.6/3.7

@YuDeng
Copy link

YuDeng commented Jun 17, 2020

Hi, I've met the same problem as yours. I follow the instruction in #8, and the problem is fixed. Hope it can help you, too.

@hearables-pkinsella
Copy link
Author

Thank you. That seems to have solved the xlib error. But I am now running into an OpenGL 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 "'NoneType' object has no attribute 'setView_'"

Is this something you have seen?

@YuDeng
Copy link

YuDeng commented Jun 18, 2020

Hi, if you are using a remote computer via SSH or some tools rely on Xserver, the OpenGL in the remote computer may not be able to run correctly. I fixed the issue by using a local pc. An alternative solution is to use some remote tools that support OpenGL such as VirtualGL mentioned in the error message.

@marian42
Copy link
Owner

@hearables-pkinsella Can you try to add this in your main python script before you import mesh_to_sdf:

os.environ['PYOPENGL_PLATFORM'] = 'egl'

Please let me know if this fixes the problem. Are you working on a computer without a screen (via ssh)? Does your computer have a GPU?

@AlexsaseXie
Copy link

AlexsaseXie commented Jul 9, 2020

@hearables-pkinsella Can you try to add this in your main python script before you import mesh_to_sdf:

os.environ['PYOPENGL_PLATFORM'] = 'egl'

Please let me know if this fixes the problem. Are you working on a computer without a screen (via ssh)? Does your computer have a GPU?

I was using ssh with X-11 forwarding and DISPLAY. I tried to run example/voxelize_chair.py got the same error with @hearables-pkinsella .
I modified example/voxelize_chair.py as you said. But I got anothor error.

(mesh_to_sdf) xieyunwei@ubuntu:~/workdir/occupancy_networks/external/mesh_to_sdf$ python example/voxelize_chair.py
Scanning...
Traceback (most recent call last):
File "example/voxelize_chair.py", line 12, in
cloud = get_surface_point_cloud(mesh, surface_point_method='scan', scan_count=20, scan_resolution=400)
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/mesh_to_sdf/init.py", line 17, in get_surface_point_cloud
return surface_point_cloud.create_from_scans(mesh, bounding_radius=bounding_radius, scan_count=scan_count, scan_resolution=scan_resolution, calculate_normals=calculate_normals)
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/mesh_to_sdf/surface_point_cloud.py", line 131, in create_from_scans
z_far=bounding_radius * 3
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/mesh_to_sdf/scan.py", line 52, in init
color, depth = render_normal_and_depth_buffers(mesh, camera, self.camera_transform, resolution)
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/mesh_to_sdf/pyrender_wrapper.py", line 58, in render_normal_and_depth_buffers
renderer = pyrender.OffscreenRenderer(resolution, resolution)
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/pyrender/offscreen.py", line 31, in init
self._create()
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/pyrender/offscreen.py", line 149, in _create
self._platform.init_context()
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/pyrender/platforms/egl.py", line 188, in init_context
EGL_NO_CONTEXT, context_attributes
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/OpenGL/platform/baseplatform.py", line 402, in call
return self( *args, **named )
File "/home/xieyunwei/.conda/envs/mesh_to_sdf/lib/python3.6/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12297,
baseOperation = eglCreateContext,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7f75a1564ea0>,
<OpenGL._opaque.EGLConfig_pointer object at 0x7f75a1564e18>,
<OpenGL._opaque.EGLContext_pointer object at 0x7f75a1504bf8>,
<OpenGL.arrays.lists.c_int_Array_7 object at 0x7f75a7fdb7b8>,
),
result = <OpenGL._opaque.EGLContext_pointer object at 0x7f75a152de18>
)

It seems like that I cannot use(initialize) EGL on my server... Are there any additional steps needed to be done?
btw I'm totally new to EGL.

@AlexsaseXie
Copy link

AlexsaseXie commented Jul 9, 2020

Hummmmmmm.
It seems that this is an environment problem that cannot be solved easily.

When you install pyrender by pip3 install pyrender. The PyOpenGL required by pyrender should be version 3.1.0. I read the code in pyrender /platforms/egl.py and found the following comments.
class EGLPlatform(Platform): """Renders using EGL (not currently working on Ubuntu). """

Here is the hint by pyrender's doc to solve the problem.
I'll try OSMesa instead...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants