https://pytorch.org/tutorials/intermediate/reinforcement_q_learning.h
I got another road block. Please help me. Thanks in advance!
Here comes an error message:
(This is run on l4t-ml:r32.4.2-py3 container)
NoSuchDisplayException Traceback (most recent call last)
in
37 env.reset()
38 plt.figure()
—> 39 plt.imshow(get_screen().cpu().squeeze(0).permute(1, 2, 0).numpy(),
40 interpolation=‘none’)
41 plt.title(‘Example extracted screen’)
in get_screen()
12 # Returned screen requested by gym is 400x600x3, but is sometimes larger
13 # such as 800x1200x3. Transpose it into torch order (CHW).
—> 14 screen = env.render(mode=‘rgb_array’).transpose((2, 0, 1))
15 # Cart is in the lower half, so strip off the top and bottom of the screen
16 _, screen_height, screen_width = screen.shape
/usr/local/lib/python3.6/dist-packages/gym/envs/classic_control/cartpole.py in render(self, mode)
172
173 if self.viewer is None:
→ 174 from gym.envs.classic_control import rendering
175 self.viewer = rendering.Viewer(screen_width, screen_height)
176 l, r, t, b = -cartwidth / 2, cartwidth / 2, cartheight / 2, -cartheight / 2
/usr/local/lib/python3.6/dist-packages/gym/envs/classic_control/rendering.py in
23
24 try:
—> 25 from pyglet.gl import *
26 except ImportError as e:
27 raise ImportError(‘’’
/usr/local/lib/python3.6/dist-packages/pyglet/gl/init.py in
242 # trickery is for circular import
243 _pyglet.gl = _sys.modules[name]
→ 244 import pyglet.window
/usr/local/lib/python3.6/dist-packages/pyglet/window/init.py in
1878 if not _is_pyglet_doc_run:
1879 pyglet.window = sys.modules[name]
→ 1880 gl._create_shadow_window()
/usr/local/lib/python3.6/dist-packages/pyglet/gl/init.py in _create_shadow_window()
218
219 from pyglet.window import Window
→ 220 _shadow_window = Window(width=1, height=1, visible=False)
221 _shadow_window.switch_to()
222
/usr/local/lib/python3.6/dist-packages/pyglet/window/xlib/init.py in init(self, *args, **kwargs)
163 self._event_handlers[message] = func
164
→ 165 super(XlibWindow, self).init(*args, **kwargs)
166
167 global _can_detect_autorepeat
/usr/local/lib/python3.6/dist-packages/pyglet/window/init.py in init(self, width, height, caption, resizable, style, fullscreen, visible, vsync, display, screen, config, context, mode)
568
569 if not display:
→ 570 display = pyglet.canvas.get_display()
571
572 if not screen:
/usr/local/lib/python3.6/dist-packages/pyglet/canvas/init.py in get_display()
92
93 # Otherwise, create a new display and return it.
—> 94 return Display()
95
96
/usr/local/lib/python3.6/dist-packages/pyglet/canvas/xlib.py in init(self, name, x_screen)
121 self._display = xlib.XOpenDisplay(name)
122 if not self._display:
→ 123 raise NoSuchDisplayException(‘Cannot connect to “%s”’ % name)
124
125 screen_count = xlib.XScreenCount(self._display)
NoSuchDisplayException: Cannot connect to “None”