nailo2c / pycon-2017-tutorial-rl

Example code of Logistic Regression, MLP, Policy Gradient for 2017 PyCon
3 stars 4 forks source link

關於在console下執行pg_tf.py問題 #1

Closed cloverhsc closed 7 years ago

cloverhsc commented 7 years ago

Hi nailo2c: 我是上個禮拜參加pycon2017課程的同學,我自己在自己的機器上面不跑docker情況下用python3 virtualenv下,把該裝的lib都裝了,跑run_MountainCar.py是可以正常運作。 但是要執行pg_tf.py (使用 xvfb-run -s "-screen 1 1400x900x24" python pg_tf.py) 就會出現 pyglet.gl.glx_info.GLXInfoException: pyglet requires an X server with GLX

參考一些網站有去apt-get org-dev libglu1-mesa libgl1-mesa-dev libxinerama1 libxcursor1 本機也有裝顯示卡driver, xvfb , cuda $echo $DISPLAY 是:1 也沒問題 作業系統是ubuntu 16.04 不知道nailo2c有遇過這個問題嗎?

nailo2c commented 7 years ago

有先試著照著openai gym的指示安裝全部相依的套件嗎? https://github.com/openai/gym

在ubuntu下執行這一行

sudo apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig

2017-05-25 19:01 GMT+08:00 Clover Hsu notifications@github.com:

Hi nailo2c: 我是上個禮拜參加pycon2017課程的同學,我自己在自己的機器上面不跑docker情況下用python3 virtualenv下,把該裝的lib都裝了,跑run_MountainCar.py是可以正常運作。 但是要執行pg_tf.py (使用 xvfb-run -s "-screen 1 1400x900x24" python pg_tf.py) 就會出現 pyglet.gl.glx_info.GLXInfoException: pyglet requires an X server with GLX

參考一些網站有去apt-get org-dev libglu1-mesa libgl1-mesa-dev libxinerama1 libxcursor1 本機也有裝顯示卡driver, xvfb , cuda $echo $DISPLAY 是:1 也沒問題 作業系統是ubuntu 16.04 不知道nailo2c有遇過這個問題嗎?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nailo2c/PyCon2017TutorialRL/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AK3NLgR3hoXC8u7_pXin0GGoRqbeGbLiks5r9V-PgaJpZM4NmQAJ .

cloverhsc commented 7 years ago

Hi nailo2c: 都裝了也是一樣。 附圖:

[image: 內置圖片 1]

-----------------------------------------執行結果----------------------------------------------------------- (venv) cloverhsc@cloverhsc-desktop:~/python3$ xvfb-run -s "-screen 1 1400x900x24" python pg_keras.py Using TensorFlow backend. [2017-05-26 09:47:13,499] Making new env: Pong-v0 [2017-05-26 09:47:13,645] Clearing 4 monitor files from previous run (because force=True was provided) [2017-05-26 09:47:13,652] Starting new video recorder writing to /home/cloverhsc/python3/pong/openaigym.video.0.487.video000000.mp4 pg_keras.py:27: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(32, activation="relu", strides=(3, 3), padding="same", kernel_size=(6, 6), kernel_initializer="he_uniform") model.add(Conv2D(32, kernel_size=(6, 6), strides=(3, 3), border_mode='same', activation='relu', init='he_uniform')) pg_keras.py:29: UserWarning: Update your Dense call to the Keras 2 API: Dense(64, activation="relu", kernel_initializer="glorot_normal") model.add(Dense(64, activation='relu', init='glorot_normal')) pg_keras.py:30: UserWarning: Update your Dense call to the Keras 2 API: Dense(32, activation="relu", kernel_initializer="glorot_normal") model.add(Dense(32, activation='relu', init='glorot_normal'))


Layer (type) Output Shape Param #

reshape_1 (Reshape) (None, 80, 80, 1) 0


conv2d_1 (Conv2D) (None, 27, 27, 32) 1184


flatten_1 (Flatten) (None, 23328) 0


dense_1 (Dense) (None, 64) 1493056


dense_2 (Dense) (None, 32) 2080


dense_3 (Dense) (None, 6) 198

Total params: 1,496,518 Trainable params: 1,496,518 Non-trainable params: 0


2017-05-26 09:47:13.733630: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-26 09:47:13.733653: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-26 09:47:13.733659: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-05-26 09:47:13.733665: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-05-26 09:47:13.733670: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. Traceback (most recent call last): File "pg_keras.py", line 100, in env.render() File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/core.py", line 153, in render return self._render(mode=mode, close=close) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/core.py", line 285, in _render return self.env.render(mode, close) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/core.py", line 153, in render return self._render(mode=mode, close=close) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/core.py", line 285, in _render return self.env.render(mode, close) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/core.py", line 153, in render return self._render(mode=mode, close=close) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/envs/atari/atari_env.py", line 117, in _render from gym.envs.classic_control import rendering File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/gym/envs/classic_control/rendering.py", line 23, in from pyglet.gl import File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/gl/init.py", line 236, in import pyglet.window File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/window/init.py", line 1816, in gl._create_shadow_window() File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/gl/init.py", line 205, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/window/xlib/init.py", line 163, in init super(XlibWindow, self).init(args, **kwargs) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/window/init.py", line 504, in init config = screen.get_best_config(template_config) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/canvas/base.py", line 161, in get_best_config configs = self.get_matching_configs(template) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/canvas/xlib.py", line 179, in get_matching_configs configs = template.match(canvas) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/gl/xlib.py", line 29, in match have_13 = info.have_version(1, 3) File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/pyglet/gl/glx_info.py", line 83, in have_version raise GLXInfoException('pyglet requires an X server with GLX') pyglet.gl.glx_info.GLXInfoException: pyglet requires an X server with GLX [2017-05-26 09:47:13,900] Finished writing results. You can upload them to the scoreboard via gym.upload('/home/cloverhsc/python3/pong') Exception ignored in: <bound method BaseSession.del of <tensorflow.python.client.session.Session object at 0x7f7a3e6d0898>> Traceback (most recent call last): File "/home/cloverhsc/python3/venv/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 587, in del TypeError: 'NoneType' object is not callable

nailo2c notifications@github.com 於 2017年5月25日 下午8:56 寫道:

有先試著照著openai gym的指示安裝全部相依的套件嗎? https://github.com/openai/gym

在ubuntu下執行這一行

sudo apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig

2017-05-25 19:01 GMT+08:00 Clover Hsu notifications@github.com:

Hi nailo2c: 我是上個禮拜參加pycon2017課程的同學,我自己在自己的機器上面不跑docker情況下用python3 virtualenv下,把該裝的lib都裝了,跑run_MountainCar.py是可以正常運作。 但是要執行pg_tf.py (使用 xvfb-run -s "-screen 1 1400x900x24" python pg_tf.py) 就會出現 pyglet.gl.glx_info.GLXInfoException: pyglet requires an X server with GLX

參考一些網站有去apt-get org-dev libglu1-mesa libgl1-mesa-dev libxinerama1 libxcursor1 本機也有裝顯示卡driver, xvfb , cuda $echo $DISPLAY 是:1 也沒問題 作業系統是ubuntu 16.04 不知道nailo2c有遇過這個問題嗎?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nailo2c/PyCon2017TutorialRL/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AK3NLgR3hoXC8u7_ pXin0GGoRqbeGbLiks5r9V-PgaJpZM4NmQAJ .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nailo2c/PyCon2017TutorialRL/issues/1#issuecomment-304003634, or mute the thread https://github.com/notifications/unsubscribe-auth/AFzZElLRGHQQq0Xo-zraNK7vOHvi95bfks5r9XqDgaJpZM4NmQAJ .

nailo2c commented 7 years ago

改跑這行看看 xvfb-run -a -s "-screen 1 1400x900x24" python pg_tf.py 可能是之前開的虛擬螢幕被佔走了,加一個-a試試看

cloverhsc commented 7 years ago

Hi nailo2c: 一樣的結果,而且目前這台機器的GLX是1.4依舊不知道為什麼不能跑。

(venv) cloverhsc@cloverhsc-desktop:~/glContext$ glxinfo name of display: :1 display: :1 screen: 0 direct rendering: Yes server glx vendor string: NVIDIA Corporation server glx version string: 1.4 server glx extensions: GLX_ARB_context_flush_control, GLX_ARB_create_context, GLX_ARB_create_context_profile, GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, GLX_ARB_multisample, GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile, GLX_EXT_create_context_es_profile, GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_stereo_tree, GLX_EXT_swap_control, GLX_EXT_swap_control_tear, GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_NV_copy_image, GLX_NV_delay_before_swap, GLX_NV_float_buffer, GLX_NV_multisample_coverage, GLX_NV_robustness_video_memory_purge, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGI_swap_control, GLX_SGI_video_sync

Nvidia driver 381.22

2017-05-26 11:18 GMT+08:00 nailo2c notifications@github.com:

改跑這行看看 xvfb-run -a -s "-screen 1 1400x900x24" python pg_tf.py 可能是之前開的虛擬螢幕被佔走了,加一個-a試試看

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nailo2c/PyCon2017TutorialRL/issues/1#issuecomment-304180653, or mute the thread https://github.com/notifications/unsubscribe-auth/AFzZEuGDGFBNHen7ae2mvrPntxXGuGfrks5r9kSPgaJpZM4NmQAJ .

nailo2c commented 7 years ago

啊,想起來了,可能是CUDA安裝時的問題,安裝時要用--no-opengl-libs指令,例如:

sudo bash cuda_8.0.61_375.26_linux.run --no-opengl-libs

記得去抓.run檔,一般的deb檔都包起來了。

可參考當天另外一位講者的環境建置 https://sites.google.com/view/caigame/%E9%A6%96%E9%A0%81/%E5%BB%BA%E7%BD%AE