How can I properly run OpenAI gym with nvidia-docker and see the environments

So I’m trying set run OpenAI gym in a docker container, but it looks like this:
enter image description here

Notice the pong window has a weird render issue where it’s repeating things and the colors are off. (in fact, if you look at the array returned by env.reset() you can see the pixel values, so the issue is in the rendering, not the x-forwarding. Here is space invaders:

enter image description here

My setup is very simple.
– I’m on a local ubuntu 16.04 install with an Nvidia gtx1060 and corei7
– I installed nvida runfile driver with –no-opengl-files (as per instructions from Nvidia and many place).
– Specifically, I’m running floydhub/pytorch docker image.

Does anyone recognize the particular render glitch and what it could mean? It almost looks like a StackOverflow of a frame buffer! What can I do to track down the bug?

You can easily reproduce this as follows:

docker run -it --user=$(id -u) --env="DISPLAY" --workdir="/home/$USER" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" floydhub/pytorch:0.1.11-gpu-py3.6 bash

Now in the image, type python and then the following:

import gym
gym.make('Pong-v0').render()

That should open up an x-forwarded window on your machine, but the display is corrupt (at least for me)

image

Above I actually used SpaceInvaders-v0

Asked By: AwokeKnowing

||

I had this issue running running on an old version of gym and a newer version of gym[atari]. This is what my pong render() looked like

enter image description here

I was able to fix it by making sure I installed the latest version of both by running

pip install gym --upgrade
pip install gym[atari] --upgrade

Then it displayed correctly

enter image description here

Answered By: alexbhandari