google-deepmind / google-deepmind/dm_control
Can the viewer work properly on WSL2?
- Dominant language
- Python
- Stars
- 4.7k
- Forks
- 764
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to call the `viewer` on WSL2 (ubuntu20.04 with WSLg) and followed the example:
```python
env = suite.load(domain_name="humanoid", task_name="stand")
action_spec = env.action_spec()
# Define a uniform random policy.
def random_policy(time_step):
del time_step # Unused.
return np.random.uniform(low=action_spec.minimum,
high=action_spec.maximum,
size=action_spec.shape)
viewer.launch(
env, policy=random_policy,
)
```
However, I got an error:
`OpenGL.error.Error: Attempt to retrieve context when no valid context`
Error info
```python3
Traceback (most recent call last):
File "test_gym.py", line 64, in
dmc_rollout("humanoid_run")
File "test_gym.py", line 57, in dmc_rollout
viewer.launch(
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/__init__.py", line 39, in launch
app = application.Application(title=title, width=width, height=height)
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/application.py", line 187, in __init__
self._window = gui.RenderWindow(width, height, title)
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/gui/glfw_gui.py", line 196, in __init__
self._fullscreen_quad = ctx.call(self._glfw_setup, self._context.window)
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/_render/executor/render_executor.py", line 138, in call
return func(*args, **kwargs)
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/gui/glfw_gui.py", line 204, in _glfw_setup
return fullscreen_quad.FullscreenQuadRenderer()
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/gui/fullscreen_quad.py", line 66, in __init__
self._init_shaders()
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/dm_control/viewer/gui/fullscreen_quad.py", line 95, in _init_shaders
GL.glVertexAttribPointer(
File "src/latebind.pyx", line 51, in OpenGL_accelerate.latebind.Curry.__call__
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 469, in glVertexAttribPointer
contextdata.setValue( key, array )
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/OpenGL/contextdata.py", line 59, in setValue
context = getContext( context )
File "/home/yan/miniconda3/envs/RL/lib/python3.8/site-packages/OpenGL/contextdata.py", line 38, in getContext
context = platform.GetCurrentContext()
OpenGL.error.Error: Attempt to retrieve context when no valid context
```
Contributor guide
Research direction
Start by reproducing the viewer.launch example on WSL2 and inspect viewer/application.py, viewer/gui/glfw_gui.py, and viewer/gui/fullscreen_quad.py around context creation and _glfw_setup. Use the traceback to trace the failure through dm_control/_render/executor/render_executor.py. Done means the viewer no longer raises the invalid-context error in the reported WSL2 environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python, ubuntu
- Domain
- computer-graphics, desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100