Gym: env.render() display error

Created on 27 Sep 2017  路  6Comments  路  Source: openai/gym

When I use SSH to connect remote server.
env.render() makes the following errors:

> python3 tt.py [2017-09-28 05:16:23,105] Making new env: CartPole-v0 Traceback (most recent call last): File "tt.py", line 5, in <module> env.render() File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 286, in _render return self.env.render(mode, close) File "/usr/local/lib/python3.5/dist-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/usr/local/lib/python3.5/dist-packages/gym/envs/classic_control/cartpole.py", line 115, in _render from gym.envs.classic_control import rendering File "/usr/local/lib/python3.5/dist-packages/gym/envs/classic_control/rendering.py", line 23, in <module> from pyglet.gl import * File "/usr/local/lib/python3.5/dist-packages/pyglet/gl/__init__.py", line 236, in <module> import pyglet.window File "/usr/local/lib/python3.5/dist-packages/pyglet/window/__init__.py", line 1816, in <module> gl._create_shadow_window() File "/usr/local/lib/python3.5/dist-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/usr/local/lib/python3.5/dist-packages/pyglet/window/xlib/__init__.py", line 163, in __init__ super(XlibWindow, self).__init__(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/pyglet/window/__init__.py", line 493, in __init__ display = get_platform().get_default_display() File "/usr/local/lib/python3.5/dist-packages/pyglet/window/__init__.py", line 1765, in get_default_display return pyglet.canvas.get_display() File "/usr/local/lib/python3.5/dist-packages/pyglet/canvas/__init__.py", line 82, in get_display return Display() File "/usr/local/lib/python3.5/dist-packages/pyglet/canvas/xlib.py", line 83, in __init__ raise NoSuchDisplayException('Cannot connect to "%s"' % name) pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

I tried all of the following methods, but it still not work.

https://github.com/openai/gym/issues/637
https://github.com/openai/universe/issues/91

Can someone help me ?

Most helpful comment

All 6 comments

I have the same problem. Have you solved it?

Thank you very much! @BIGBALLON

So I've been following the installation procedure as mentioned above on https://github.com/2017-fall-DL-training-program/Setup_tutorial/blob/master/OpenAI-gym-install.md

But I keep getting the following issues when I run anydesk:

No UTF-8. Trying to change locale.
Locale sucessfully changed.
No protocol specified

(anydesk:11313): Gtk-WARNING **: cannot open display: :0
No UTF-8. Trying to change locale.
Locale sucessfully changed.
No protocol specified

(anydesk:11315): Gtk-WARNING **: cannot open display: :0
No protocol specified

Did you guys have to deal with this too?

@jamsawamsa I met the same problem. Have you solved your problem?

@jamsawamsa I found a way to solve the "No protocol specified" problem. First, make sure to use an SSH client to support x11 forwarding, e.g. Putty. It seems that OpenSSH does not. Then follow the steps here https://unix.stackexchange.com/a/12772/294158 to set up x11 forwarding. Third, install Xming and keep it running when using SSH to connect to the server.

However, the render problem mentioned by @BIGBALLON still remained. I finally solved the render problem by following the steps here.

.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hipoglucido picture hipoglucido  路  4Comments

pickittwice picture pickittwice  路  4Comments

Baichenjia picture Baichenjia  路  3Comments

Gawne picture Gawne  路  4Comments

tylerlekang picture tylerlekang  路  3Comments