Skip to content

"NameError: name 'base' is not defined" in DQN tutorial #16

Closed
@moskomule

Description

@moskomule

Thanks for pretty nice tutorial, but I have a problem when running the DQN tutorial.
I ran it on an Ubuntu server then got an error message bellow at the ** Input extraction ** section.

NameError                                 Traceback (most recent call last)
<ipython-input-7-ca07103bb7e3> in <module>()
     30 
     31 
---> 32 plt.imshow(get_screen().squeeze(0).permute(1, 2, 0).numpy(), interpolation='none')
     33 # plt.show()

<ipython-input-7-ca07103bb7e3> in get_screen()
     10 
     11 def get_screen():
---> 12     screen = env.render(mode='rgb_array').transpose((2, 0, 1)) # transpose into torch order (CHW)
     13     # Strip off the top and bottom of the screen
     14     screen = screen[:, 160:320]

/home/USER/anaconda3/lib/python3.5/site-packages/gym/core.py in render(self, mode, close)
    172             raise error.UnsupportedMode('Unsupported rendering mode: {}. (Supported modes for {}: {})'.format(mode, self, modes))
    173 
--> 174         return self._render(mode=mode, close=close)
    175 
    176     def close(self):

/home/USER/anaconda3/lib/python3.5/site-packages/gym/envs/classic_control/cartpole.py in _render(self, mode, close)
    111 
    112         if self.viewer is None:
--> 113             from gym.envs.classic_control import rendering
    114             self.viewer = rendering.Viewer(screen_width, screen_height)
    115             l,r,t,b = -cartwidth/2, cartwidth/2, cartheight/2, -cartheight/2

/home/USER/anaconda3/lib/python3.5/site-packages/gym/envs/classic_control/rendering.py in <module>()
     21 
     22 try:
---> 23     from pyglet.gl import *
     24 except ImportError as e:
     25     reraise(prefix="Error occured while running `from pyglet.gl import *`",suffix="HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'. If you're running on a server, you may need a virtual frame buffer; something like this should work: 'xvfb-run -s \"-screen 0 1400x900x24\" python <your_script.py>'")

/home/USER/anaconda3/lib/python3.5/site-packages/pyglet/gl/__init__.py in <module>()
    222     else:
    223         from .carbon import CarbonConfig as Config
--> 224 del base
    225 
    226 # XXX remove

NameError: name 'base' is not defined

xvfb-run may work with python command but how to manage or fix this problem with Jupyter? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions