Remote rendering issue with env.render(mode='rgb_array') and env.get_image()
See original GitHub issueThis is an issue I typically have with Mujoco-based simulations when running remotely. Basically rendering is problematic, even in rgb_array mode where we want to access the image frames.
Is there a workaround for this issue? The OpenAI gym envs have the same issue and I only know DMSuite somehow bypasses this - where I can render in rgb_array mode.
So the errors you would get are the followings :
- env.render(mode='rgb_array')
GLFW error (code %d): %s 65542 b'EGL: Failed to get EGL display: Success'
Creating window glfw
X Error of failed request:  255
  Major opcode of failed request:  155 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  136
  Current serial number in output stream:  137
- env.get_image(width=84, height=84)
ERROR: GLEW initalization error: Missing GL version
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
 Top Results From Across the Web
Top Results From Across the Web
I'm getting an error with env rendering - Stack Overflow
I have figured it out by myself. The solution was to just change the environment that we are working by updating render_mode='human' in...
Read more >Rendering Environment Outputs & Q-Learning
In this article you'll learn how to render OpenAI environment outputs with env.step() functionality, which we refrained from using earlier in environments like ......
Read more >gym render in jupyter | The AI Search Engine You Control
(rendered indirectly using Ipython display). env = gym.make("CartPole-v0") env.reset() prev_screen = env.render(mode='rgb_array') plt.imshow(prev_screen) ...
Read more >DQN PER with Convolutional Neural Networks - PyLessons
So, here is the function to get rendered pixels: img = env.render(mode='rgb_array'). We'll see the following RGB image:.
Read more >Rendering OpenAI Gym Envs on Binder and Google Colab
Getting OpenAI Gym environments to render properly in remote ... state = env.reset() img = plt.imshow(env.render(mode='rgb_array')) done ...
Read more > Top Related Medium Post
Top Related Medium Post
No results found
 Top Related StackOverflow Question
Top Related StackOverflow Question
No results found
 Troubleshoot Live Code
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free Top Related Reddit Thread
Top Related Reddit Thread
No results found
 Top Related Hackernoon Post
Top Related Hackernoon Post
No results found
 Top Related Tweet
Top Related Tweet
No results found
 Top Related Dev.to Post
Top Related Dev.to Post
No results found
 Top Related Hashnode Post
Top Related Hashnode Post
No results found

Are you rendering environments on a machine without a display (i.e. headless)?
If so, the way we get usually get around this limitation with gym (mujoco_py) is to introduce a fake display. This gives OpenGL an in-memory frame buffer to which it can render frames, so that they can later be read out when you call
env.render(mode='rgb_array')Our Dockerfile does exactly this so that we can run tests with rendering on the CI servers.
Some options, you can…:
make runfrom the root of the repository.xvfband then calling your entrypoint withxvfb-run(see this example from the Dockerfiles)Note: dm_control avoid this limitation by having a more sophisticated rendering backend, which choose a different rendering driver system if it detects the machine is headless.
I found how to solve this problem