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

[Question] Off-screen rendering results in ERROR: GLEW initalization error: Missing GL version #114

Closed
hermanjakobsen opened this issue Oct 6, 2020 · 16 comments

Comments

@hermanjakobsen
Copy link
Contributor

For instance, creating the environment

env = robosuite.make(
    'Lift',
    robots='Panda',
    gripper_types="PandaGripper",
)

gives the mentioned error. The environment renders fine, however, using on-screen rendering

env_test = suite.make(
    'Lift',
    robots='Panda',
    gripper_types="PandaGripper",
    has_renderer=True,
    has_offscreen_renderer=False,
    use_camera_obs=False,
    use_object_obs=False
)

I have checked out the issues in the mujoco-py repo and it looks like this is a known problem with mujoco-py.
My question is: Do you guys know of any workaround to make off-screen rendering work? I have tried the tips given in the linked issue without any luck :(

@yukezhu
Copy link
Member

yukezhu commented Oct 6, 2020

Hi @hermanjakobsen can you let us know your system runtime, like your OS and Python version? Thanks.

@hermanjakobsen
Copy link
Contributor Author

OS: Ubuntu 20.04.1 LTS
Python version: Python 3.8.2
I tried to use pdb to debug, but I could not find any useful information from the stacktrace.
If it is of any interest, my LD_LIBRARY_PATH is set to the following in ~/.bashrc

export LD_LIBRARY_PATH=$WEBOTS_HOME/lib  # Add the Webots libraries to the library path (useful when launching Webots directly without using the launcher).
export LD_LIBRARY_PATH=/usr/lib/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/lib/cuda/include:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hermankj/.mujoco/mujoco200/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/hermankj/.mujoco/mjpro150/bin
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/x86_64-linux-gnu/libGL.so

@cremebrule
Copy link
Member

I don't think I've run into this issue before. Have you tried updating some of the packages, as suggested in this comment here?

@hermanjakobsen
Copy link
Contributor Author

Yes, I have tried it without any luck ://

@cremebrule
Copy link
Member

Hmm, unfortunately none of our team is directly able to replicate the issue -- Ubuntu 20.04 is relatively new, and we officially support 16.04 / 18.04, and MacOS since that is what our team uses. Is there any way you might be able to test on an earlier distro of Ubuntu? I would also suggest posting this issue on the mujoco-py repo as it sounds like an issue directly related to mujoco.

@hermanjakobsen
Copy link
Contributor Author

I will try to look into it! Thank you for your help and time :)

@yukezhu yukezhu closed this as completed Oct 10, 2020
@HeegerGao
Copy link

Hi, I have come to the same issue. When I use on_screen renderer, it works normally:

suite.make(
    **config,
    has_renderer=True,
    reward_shaping=True,
    render_camera='agentview',
    has_offscreen_renderer=False,
    use_camera_obs=False,
    hard_reset=False
    )

But when I use off_screen renderer, it shows 'ERROR: GLEW initalization error: Missing GL version':

suite.make(
    **env_config,
    has_renderer=False,  # no on-screen renderer
    has_offscreen_renderer=True,  # off-screen renderer is required for camera observations
    ignore_done=True,  # (optional) never terminates episode
    use_camera_obs=True,  # use camera observations
    camera_heights=84,  # set camera height
    camera_widths=84,  # set camera width
    camera_names="agentview",  # use "agentview" camera
    use_object_obs=False,  # no object feature when training on pixels
    reward_shaping=True,  # (optional) using a shaping reward
)

Do you have any ideas?

@hermanjakobsen
Copy link
Contributor Author

@HeegerGao, could you state your system runtime? It might be useful information for @cremebrule.

@HeegerGao
Copy link

OK. I am using Ubuntu 18.04. The error message is like this:

ERROR: GLEW initalization error: Missing GL version

Press Enter to exit ...

@HeegerGao
Copy link

And I am using mujoco200

@HeegerGao
Copy link

Hi, I think I have solved this problem, though I am not quite sure about the principle behind it.

I found the same issue in mujoco-py. They said we should do as following:

In Ubuntu 18.04.3 LTS:
sudo mkdir -p /usr/lib/nvidia-000
Then add this in ~/.bashrc file:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia-000

The I run my code again. It starts compiling mujoco_py/cymj.pyx and cythonizing mujoco_py/cymj.pyx, and after a while, it starts running normally.

According to the discussion in the issue, the problem may come from a too higher version of OpenGL.

That's my solution, and I would appreciate it if you can explain the principle behind it. Thank you!

@cremebrule
Copy link
Member

Hi HeegerGao,

Unfortunately, we don't have much control over the mujoco-py backend -- we've always had issues with the renderer specifically as well, which are still unsolved to date. So this sounds like one of those issues you simply have to find a workaround for :/

We do have some alternative rendering options in the works, so I would stay tuned for some updates in the near future!

@xu-george
Copy link

add the following lines on the base.py, could solve the problem for me

        if self.sim._render_context_offscreen is None:
            from mujoco_py import GlfwContext
            GlfwContext(offscreen=True)
            render_context = MjRenderContextOffscreen(self.sim, device_id=self.render_gpu_device_id)
            self.sim.add_render_context(render_context)
        self.sim._render_context_offscreen.vopt.geomgroup[0] = (1 if self.r

@kaixindelele
Copy link

add the following lines on the base.py, could solve the problem for me

        if self.sim._render_context_offscreen is None:
            from mujoco_py import GlfwContext
            GlfwContext(offscreen=True)
            render_context = MjRenderContextOffscreen(self.sim, device_id=self.render_gpu_device_id)
            self.sim.add_render_context(render_context)
        self.sim._render_context_offscreen.vopt.geomgroup[0] = (1 if self.r

hi, the code is not complete~

@xu-george
Copy link

add the following lines on the base.py, could solve the problem for me

        if self.sim._render_context_offscreen is None:
            from mujoco_py import GlfwContext
            GlfwContext(offscreen=True)
            render_context = MjRenderContextOffscreen(self.sim, device_id=self.render_gpu_device_id)
            self.sim.add_render_context(render_context)
        self.sim._render_context_offscreen.vopt.geomgroup[0] = (1 if self.r

hi, the code is not complete~
compare with original code, just one line is added

@sqdy2669
Copy link

在 base.py 上添加以下几行,可以解决我的问题

        if self.sim._render_context_offscreen is None:
            from mujoco_py import GlfwContext
            GlfwContext(offscreen=True)
            render_context = MjRenderContextOffscreen(self.sim, device_id=self.render_gpu_device_id)
            self.sim.add_render_context(render_context)
        self.sim._render_context_offscreen.vopt.geomgroup[0] = (1 if self.r

It really does help!

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

7 participants