question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Headless rendering error when executing in Docker

See original GitHub issue

I’m having troubles executing a script in Docker

The script is:

import os
os.environ['DISABLE_MUJOCO_RENDERING'] = '1'

from dm_control import suite

env = suite.load(domain_name="humanoid", task_name="stand")
action_spec = env.action_spec()


print(action_spec)

What doesn’t make sense to me is that when I ssh the machine and execute this script it works without a problem but after building a docker image and running it I get the following:

Traceback (most recent call last):
  File "test_dm_control.py", line 4, in <module>
    from dm_control import suite
  File "/usr/local/lib/python3.6/dist-packages/dm_control/suite/__init__.py", line 28, in <module>
    from dm_control.suite import acrobot
  File "/usr/local/lib/python3.6/dist-packages/dm_control/suite/acrobot.py", line 24, in <module>
    from dm_control import mujoco
  File "/usr/local/lib/python3.6/dist-packages/dm_control/mujoco/__init__.py", line 18, in <module>
    from dm_control.mujoco.engine import action_spec
  File "/usr/local/lib/python3.6/dist-packages/dm_control/mujoco/engine.py", line 44, in <module>
    from dm_control import _render
  File "/usr/local/lib/python3.6/dist-packages/dm_control/_render/__init__.py", line 75, in <module>
    Renderer = import_func()
  File "/usr/local/lib/python3.6/dist-packages/dm_control/_render/__init__.py", line 36, in _import_egl
    from dm_control._render.pyopengl.egl_renderer import EGLContext
  File "/usr/local/lib/python3.6/dist-packages/dm_control/_render/pyopengl/egl_renderer.py", line 43, in <module>
    from dm_control._render.pyopengl import egl_ext as EGL
  File "/usr/local/lib/python3.6/dist-packages/dm_control/_render/pyopengl/egl_ext.py", line 33, in <module>
    from OpenGL import EGL
  File "/usr/local/lib/python3.6/dist-packages/OpenGL/EGL/__init__.py", line 2, in <module>
    from OpenGL.raw.EGL._types import *
  File "/usr/local/lib/python3.6/dist-packages/OpenGL/raw/EGL/_types.py", line 87, in <module>
    raw_eglQueryString = _p.PLATFORM.EGL.eglQueryString
AttributeError: 'NoneType' object has no attribute 'eglQueryString'

The docker file is:

# Use the official image as a parent image
FROM tensorflow/tensorflow:2.0.0-gpu-py3

ENV MJLIB_PATH=/tf/mujoco200_linux/bin/libmujoco200.so
ENV MJKEY_PATH=/tf/mujoco200_linux/bin/mjkey.txt
ENV LD_LIBRARY_PATH=/tf/mujoco200_linux/bin/
ENV PYGLFW_LIBRARY=/tf/mujoco200_linux/bin/libglfw.so.3

# i need this for ffmpeg
ENV PATH="/tf/.local/bin/:${PATH}"

# Run the command inside your image filesystem
RUN pip install --upgrade pip && \
        pip install gym && \
    pip install gym[atari] && \
        pip install dm_control && \
        pip install tqdm && \
        pip install np_utils && \
        pip install opencv-python

The OS both on the server and in Docker is Ubuntu. Thanks a lot for any help you can provide!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
gabriel-hurtadocommented, May 4, 2021

I solved a similar bug by doing pip install pyrender

2reactions
alimuldalcommented, Mar 11, 2020

Ah I see, you were missing the libgl1-mesa-glx and libosmesa6 deps described here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error running headless Paraview EGL image in Docker
Hi all, Trying to run kitware/paraview:pv-v5.8.0-egl-py3 image in docker using following command docker run --gpus all -ti ...
Read more >
Installing Headless chromium w/o docker - Render community
I was still getting an error when my app tried to use Chrome. So I SSH'd into the box to check the path,...
Read more >
Docker + WebGL + Headless Chrome Error - node.js
Running the code inside a Docker container (Ubuntu + Node.js + Chrome) does not work. It takes a screenshot, but the 3D canvas...
Read more >
Headless Browser troubleshooting - ServiceNow Docs
Headless client test runner did not start in the time allotted message: This message generally means an error occurred in the Docker container...
Read more >
Performance tips — MineRL 0.4.0 documentation
Running MineRL on xvfb will slow it down by 2-3x as the rendering is done on CPU, not on the GPU. ... To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found