RuntimeError:尝试使用已关闭的Session

时间:2016-10-30 04:19:02

标签: python ssh debian tensorflow

我想在Debian 8服务器上运行https://stackoverflow.com/a/29398380/2724978

我已安装所有依赖项,并使用

进行ssh
ssh -Y user@domain.com

但是,当我运行该代码时,我收到错误:

> Traceback (most recent call last):   File
> "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "ML/test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.

请注意,此代码会创建新的GUI窗口

当我原生运行时(没有ssh,通过物理登录gnome环境) 运行得很好。(我能看到那些窗户)

编辑:

我不知道发生了什么,但现在它显示更多错误:

> **libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast** Traceback (most recent call last):  
> File "test.py", line 453, in <module>
>     tf.app.run()   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py",
> line 30, in run
>     sys.exit(main(sys.argv))   File "test.py", line 450, in main
>     train(session, graph_ops, num_actions, saver)   File "test.py", line 399, in train
>     env.render()   File "/usr/local/lib/python2.7/dist-packages/gym/core.py", line 192, 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 <module>
>     from pyglet.gl import *   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/__init__.py", line
> 236, in <module>
>     import pyglet.window   File "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py",
> line 1817, in <module>
>     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) Exception in thread Thread-11: Traceback (most recent call last):   File
> "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 246, in actor_learner_thread
>     feed_dict = {st : [s_t1]})   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.
> 
>   File
> "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py",
> line 559, in __init__
>     self._create()   File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/__init__.py",
> line 260, in _create
>     self.context.attach(self.canvas)   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 321,
> in attach
>     self.set_current()   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 326,
> in set_current
>     super(XlibContext13, self).set_current()   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/base.py", line 300,
> in set_current
>     gl_info.set_active_context()   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/gl_info.py", line
> 96, in set_active_context
>     if self.have_version(3):   File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/gl_info.py", line
> 166, in have_version
>     imajor, iminor, irelease = [int(v) for v in ver.split('.', 3)[:3]] ValueError: invalid literal for int() with base 10: 'None' Exception
> in thread Thread-12: Traceback (most recent call last):   File
> "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.
> 
> Exception in thread Thread-13: Traceback (most recent call last):  
> File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.
> 
> Exception in thread Thread-14: Traceback (most recent call last):  
> File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.
> 
> ^C^C^C^C^C^C^C^CException in thread Thread-15: Traceback (most recent
> call last):   File "/usr/lib/python2.7/threading.py", line 810, in
> __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.
> 
> ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^CException
> in thread Thread-16: Traceback (most recent call last):   File
> "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
>     self.run()   File "/usr/lib/python2.7/threading.py", line 763, in run
>     self.__target(*self.__args, **self.__kwargs)   File "test.py", line 227, in actor_learner_thread
>     readout_t = q_values.eval(session=session, feed_dict={s: [s_t]})   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 559, in eval
>     return _eval_using_default_session(self, feed_dict, self.graph, session)   File
> "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py",
> line 3656, in _eval_using_default_session
>     return session.run(tensors, feed_dict)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 710, in run
>     run_metadata_ptr)   File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py",
> line 846, in _run
>     raise RuntimeError('Attempted to use a closed Session.') RuntimeError: Attempted to use a closed Session.

0 个答案:

没有答案