Closed SavvaI closed 7 years ago
Hey, I have the same problem. Digging a bit into the code, I discovered that for some reason glXGetClientVersion returns None when trying to render AIGym's world. I don't know exactly why this happens, but my guess is that it has something to do with tf session initialization.
While fiddling with the code I also found a (very dirty) hotfix for this problem - you just need to initialize a dummy environment before you initialize the tf session. The simplest way to this is to edit main.py a little bit:
add
import gym
at the top, and, inside main
, create a new g_env
variable:
def main(_):
gpu_options = tf.GPUOptions(
per_process_gpu_memory_fraction=calc_gpu_fraction(FLAGS.gpu_fraction))
g_env = gym.make('Breakout-v0')
g_env.render()
with tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) as sess:
I know this is really weird and does not solve the issue, but it might get you going until devs look into this.
For me, just add: import gym g_env = gym.make('Breakout-v0') g_env.render()
at the very top of main.py, before import tensorflow as tf. I believe there is some conflict between glx with NVidia.
When running DQN with --display option getting the following error Traceback (most recent call last): File "main.py", line 66, in
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
sys.exit(main(sys.argv[:1] + flags_passthrough))
File "main.py", line 61, in main
agent.train()
File "/home/savvai/Documents/DQN-tensorflow/dqn/agent.py", line 40, in train
screen, reward, action, terminal = self.env.new_random_game()
File "/home/savvai/Documents/DQN-tensorflow/dqn/environment.py", line 28, in new_random_game
self.new_game(True)
File "/home/savvai/Documents/DQN-tensorflow/dqn/environment.py", line 24, in new_game
self.render()
File "/home/savvai/Documents/DQN-tensorflow/dqn/environment.py", line 60, in render
self.env.render()
File "/usr/local/lib/python2.7/dist-packages/gym/core.py", line 174, in render
return self._render(mode=mode, close=close)
File "/usr/local/lib/python2.7/dist-packages/gym/envs/atari/atari_env.py", line 119, in _render
from gym.envs.classic_control import rendering
File "/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/rendering.py", line 23, in
from pyglet.gl import
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/init.py", line 236, in
import pyglet.window
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/init.py", line 1817, in
gl._create_shadow_window()
File "/usr/local/lib/python2.7/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/python2.7/dist-packages/pyglet/window/xlib/init.py", line 163, in init
super(XlibWindow, self).init( args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/init.py", line 505, in init
config = screen.get_best_config(template_config)
File "/usr/local/lib/python2.7/dist-packages/pyglet/canvas/base.py", line 161, in get_best_config
configs = self.get_matching_configs(template)
File "/usr/local/lib/python2.7/dist-packages/pyglet/canvas/xlib.py", line 179, in get_matching_configs
configs = template.match(canvas)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 29, in match
have_13 = info.have_version(1, 3)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/glx_info.py", line 89, in have_version
client = [int(i) for i in client_version.split('.')]
ValueError: invalid literal for int() with base 10: 'None'