Gym: NoSuchDisplayException: Cannot connect to "None"

Created on 6 Mar 2018  路  6Comments  路  Source: openai/gym

Hi,
New to gym. I have a nvidia-docker container with cntk installed, and wish to use reinforcement learning algorithms on some gym environments.
I started up the container by following the instructions here, installed apt install python-opengl and tried to render a simple simulation as follows

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

On doing this i am greeted with the error message

NoSuchDisplayException: Cannot connect to "None"

Can someone direct me in how to use nvidia docker containers to run gym environments.

Most helpful comment

Yep, this did the trick:

export DISPLAY=localhost:0.0

All 6 comments

try this link

Thanks for answering this @MuLx10! As the link describes you need to run an X11 server on linux in order to get rendering to work, at least until pyglet supports EGL rendering: https://bitbucket.org/pyglet/pyglet/issues/219/egl-support-headless-rendering

I am running it in WSL on windows. Same error. I am running an X11 server. I think I need to set the display first.

Yep, this did the trick:

export DISPLAY=localhost:0.0

Yep, this did the trick:

export DISPLAY=localhost:0.0 

I had to replace localhost with the actual private IP 192.168.1.111:0.0

I also faced the same issue. I was doing it on Colab and Jupyter Notebook. I got the same errors.

Then I tried to run it on PyCharm and it worked!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RuofanKong picture RuofanKong  路  3Comments

Gawne picture Gawne  路  4Comments

RuofanKong picture RuofanKong  路  4Comments

Kallin picture Kallin  路  4Comments

hipoglucido picture hipoglucido  路  4Comments