【强化学习】百度云BCC openai gym 环境配置
openai gym是RL算法的测试床。为了直观和便于调试,我们需要可视化界面。然而远程服务器使用openGL的问题比较棘手,这篇博客记录在百度云BCC上配置openai gym环境的注意事项。
按照gym的指示,需要用
xvfb-run -s "-screen 0 1400x900x24" bash 来创建fake display
然而,运行到env.render()时会有这样的问题:pyglet requires an X server with GLX
也就是说,我们的openGL没有GLX扩展
if the Nvidia proprietary driver (e.g. 340.93) is installed, our OpenGL apps fail to create an OpenGL context when using Xvfb's display. The very same happens to glxinfo and glxgears in this scenario
gym里这个issue的解决方案给了很好的提示:nvidia的显卡驱动要 --no-opengl-files , CUDA要 --no-opengl-libs
所以要重装nvidia显卡驱动,如下所示
可以参考一个很详细的步骤:
https://davidsanwald.github.io/2016/11/13/building-tensorflow-with-gpu-support.html
注意安装CUDA的时候选择
安装成功之后,运行demo不会报错
再安装gnome桌面环境和vnc4server,远程连接后就可以有图像显示了
运行时,
xvfb-run -a -s "-screen 0 1400x900x24 +extension RANDR" -- -python test.py
或
xvfb-run -s "-screen 0 1400x900x24" bash
glxinfo查看glx信息
vnc4server创建新的端口
参考:
https://github.com/openai/gym/issues/384
https://davidsanwald.github.io/2016/11/13/building-tensorflow-with-gpu-support.html
https://github.com/openai/gym/issues/347
https://github.com/2017-fall-DL-training-program/Setup_tutorial/blob/master/OpenAI-gym-install.md