tflearn / tflearn

Deep learning library featuring a higher-level API for TensorFlow.
http://tflearn.org
Other
9.62k stars 2.41k forks source link

tflearn and gym.render() cannot work together #467

Open taochenshh opened 7 years ago

taochenshh commented 7 years ago

I just used the following code. And the code ran fine when import tflearn was commented. If I have both import tflearn and env.render(), error occurred.

import tflearn
import tensorflow as tf
import gym
with tf.Session() as sess:
    env = gym.make('Pendulum-v0')
    env.seed(1234)
    env.reset()
    env.render()

The error is like this:

I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: 
name: GeForce GTX 980
major: 5 minor: 2 memoryClockRate (GHz) 1.253
pciBusID 0000:01:00.0
Total memory: 3.93GiB
Free memory: 3.31GiB
W tensorflow/stream_executor/cuda/cuda_driver.cc:572] creating context when one is currently active; existing: 0x36e0a20
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 1 with properties: 
name: GeForce GTX 980
major: 5 minor: 2 memoryClockRate (GHz) 1.253
pciBusID 0000:07:00.0
Total memory: 3.94GiB
Free memory: 3.87GiB
I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 1 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0:   Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 1:   Y Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 980, pci bus id: 0000:01:00.0)
I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:1) -> (device: 1, name: GeForce GTX 980, pci bus id: 0000:07:00.0)
[2016-11-17 10:40:25,058] Making new env: Pendulum-v0
Traceback (most recent call last):
  File "test.py", line 14, in <module>
    env.render()
  File "/home/chentao/software/gym/gym/core.py", line 192, in render
    return self._render(mode=mode, close=close)
  File "/home/chentao/software/gym/gym/envs/classic_control/pendulum.py", line 66, in _render
    from gym.envs.classic_control import rendering
  File "/home/chentao/software/gym/gym/envs/classic_control/rendering.py", line 23, in <module>
    from pyglet.gl import *
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/gl/__init__.py", line 236, in <module>
    import pyglet.window
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/window/__init__.py", line 1817, in <module>
    gl._create_shadow_window()
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/window/xlib/__init__.py", line 163, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/window/__init__.py", line 505, in __init__
    config = screen.get_best_config(template_config)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/canvas/base.py", line 161, in get_best_config
    configs = self.get_matching_configs(template)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/canvas/xlib.py", line 179, in get_matching_configs
    configs = template.match(canvas)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-packages/pyglet/gl/xlib.py", line 29, in match
    have_13 = info.have_version(1, 3)
  File "/home/chentao/software/anaconda2/envs/tensorflow/lib/python2.7/site-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'
aymericdamien commented 7 years ago

Can you try to import tflearn after calling .render() ? From the error trace, I cannot see anything linked with tflearn.

taochenshh commented 7 years ago

@aymericdamien Yes, I can import tflearn after calling.render(). Why does this happen? Is there some conflict between tflearn and gym?

aymericdamien commented 7 years ago

I am not sure what is wrong there :/ We should investigate that

tanayjha commented 7 years ago

Is there any workaround for this? Facing the same problem :(

FarshadKoohifar commented 7 years ago

Any updates on this? I run the Q learning example and get the same error:

Traceback (most recent call last): File "/root/repos/sc2/farshadTensor/tfLearnGym.py", line 465, in tf.app.run() File "/root/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "/root/repos/sc2/farshadTensor/tfLearnGym.py", line 462, in main train(session, graph_ops, num_actions, saver) File "/root/repos/sc2/farshadTensor/tfLearnGym.py", line 411, in train env.render() File "/root/tensorflow/local/lib/python2.7/site-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/root/tensorflow/local/lib/python2.7/site-packages/gym/core.py", line 286, in _render return self.env.render(mode, close) File "/root/tensorflow/local/lib/python2.7/site-packages/gym/core.py", line 150, in render return self._render(mode=mode, close=close) File "/root/tensorflow/local/lib/python2.7/site-packages/gym/envs/atari/atari_env.py", line 117, in _render from gym.envs.classic_control import rendering File "/root/tensorflow/local/lib/python2.7/site-packages/gym/envs/classic_control/rendering.py", line 23, in from pyglet.gl import File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/gl/init.py", line 236, in import pyglet.window File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/window/init.py", line 1817, in gl._create_shadow_window() File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/gl/init.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/window/xlib/init.py", line 163, in init super(XlibWindow, self).init(args, **kwargs) File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/window/init.py", line 505, in init config = screen.get_best_config(template_config) File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/canvas/base.py", line 161, in get_best_config configs = self.get_matching_configs(template) File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/canvas/xlib.py", line 179, in get_matching_configs configs = template.match(canvas) File "/root/tensorflow/local/lib/python2.7/site-packages/pyglet/gl/xlib.py", line 29, in match have_13 = info.have_version(1, 3) File "/root/tensorflow/local/lib/python2.7/site-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'