TransWikia.com

Problem with AI gym from Google Collaboratory

Data Science Asked by Hermes Morales on April 6, 2021

I am a neophyte trying to learn and nowadays I am studying Raschka’s 3rd edition Python Machine Learning.

I am currently using Google Collaboratory and I am having an error when executing the gridworld_env.py file

Here is my code.

I have successfully found the method to execute it. I loaded it to the notebook environment:

Figure shown the loaded gridworld_env.py file loaded

and execute it with:

!python gridworld_env.py

but I am getting the following error:

    Traceback (most recent call last):
    File "gridworld_env.py", line 25, in <module>
    from gym.envs.classic_control import rendering
    File "/usr/local/lib/python3.6/dist-packages/gym/envs/classic_control/rendering.py", line 25, in 
    <module>
    from pyglet.gl import *
    File "/usr/local/lib/python3.6/dist-packages/pyglet/gl/__init__.py", line 244, in <module>
    import pyglet.window
    File "/usr/local/lib/python3.6/dist-packages/pyglet/window/__init__.py", line 1880, in <module>
    gl._create_shadow_window()
   File "/usr/local/lib/python3.6/dist-packages/pyglet/gl/__init__.py", line 220, in 
   _create_shadow_window
   _shadow_window = Window(width=1, height=1, visible=False)
   File "/usr/local/lib/python3.6/dist-packages/pyglet/window/xlib/__init__.py", line 165, in 
   __init__
  super(XlibWindow, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/pyglet/window/__init__.py", line 570, in __init__
  display = pyglet.canvas.get_display()
  File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/__init__.py", line 94, in get_display
  return Display()
  File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/xlib.py", line 123, in __init__
  raise NoSuchDisplayException('Cannot connect to "%s"' % name)
  pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

I have searched in the web but until now I have not been able to find how to fix it. Thanks if anybody can send me a tip for solving it.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP