I am using a xrdp remote connecting to a Ubuntu14.04 desktop machine, which successfully installed tensorflow and caffe.
After i install gym and run
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
libGL error occurs.
using "LIBGL_DEBUG=verbose glxgears" , it outputs:
libGL: screen 0 does not appear to be DRI3 capable
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: driver does not expose __driDriverGetExtensions_swrast(): /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so: undefined symbol: __driDriverGetExtensions_swrast
libGL: Can't open configuration file /home/lfwin/.drirc: No such file or directory.
libGL: Can't open configuration file /home/lfwin/.drirc: No such file or directory.
3751 frames in 5.0 seconds = 750.148 FPS
4278 frames in 5.0 seconds = 855.515 FPS
I googled, but need reinstall nvidia drivers.
EDIT: After i update nvidia drivers, it works in local Ubuntu14.04 desktop machine, but still have error in remote connection
Can you give more detail on what the current problem is?
Hi, @tlbtlbtlb
Now, the problem is when running following code in eclipse in a remote desktop connection using xrdp which connecting to a Ubuntu 14.04 server computer,
import pdb
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
print("success")
this error below happens:
"
libGL error: failed to load driver: swrast
Traceback (most recent call last):
File "/home/lfwin/workspace/homework/hw1/test_gym.py", line 7, in
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/classic_control/cartpole.py", line 142, in _render
return self.viewer.render(return_rgb_array = mode=='rgb_array')
File "/usr/local/lib/python2.7/dist-packages/gym/envs/classic_control/rendering.py", line 84, in render
self.window.dispatch_events()
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/__init__.py", line 840, in dispatch_events
self.dispatch_pending_events()
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/__init__.py", line 880, in dispatch_pending_events
EventDispatcher.dispatch_event(self, self._event_queue.pop(0))
File "/usr/local/lib/python2.7/dist-packages/pyglet/event.py", line 365, in dispatch_event
if getattr(self, event_type)(args):
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py", line 722, in on_resize
gl.glOrtho(0, width, 0, height, -1, 1)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/lib.py", line 104, in errcheck
raise GLException(msg)
pyglet.gl.lib.GLException: invalid value
"
if I run above code using shell, it runs well and display:
"
[2017-02-24 21:18:02,573] Making new env: CartPole-v0
success
success
...
"
but not display animation.
but if i run locally on the ubuntu14.04 computer, all goes right.
I want to run on remote windows computer.
You need the swrast driver installed for OpenGL rendering to work in headless mode. Typically, apt-get intall -y mesa-utils and libgl1-mesa-glx will do it. But if you have proprietary video drivers installed, it may take some googling to find the answer.
Hi,
I run test LIBGL_DEBUG=verbose glxinfo|grep renderer, it outputs
PowerEdge-R730:~$ LIBGL_DEBUG=verbose glxinfo|grep renderer
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: driver does not expose __driDriverGetExtensions_swrast(): /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so: undefined symbol: __driDriverGetExtensions_swrast
libGL: Can't open configuration file /home/lfwin/.drirc: No such file or directory.
libGL: Can't open configuration file /home/lfwin/.drirc: No such file or directory.
libGL error: failed to load driver: swrast
and swarast_dri.so can be find as follows.
PowerEdge-R730:~$ locate swrast_dri.so
/usr/lib/i386-linux-gnu/dri/swrast_dri.so
/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
Also, video drivers, mesa-utils and libgl1-mesa-glx all upgraded.
It's a common problem with Ubuntu 14.04 and nVidia drivers. Easy solutions are to uninstall the nvidia drivers, or upgrade to Ubuntu 16.04. Many other solutions at https://encrypted.google.com/search?hl=en&q=driver%20does%20not%20expose%20__driDriverGetExtensions_swrast
Note: I fixed this by using nvidia-docker instead
Based on the dockerfile of nvidia/cuda, I can solve this problem.
https://gitlab.com/nvidia/cuda/blob/ubuntu16.04/8.0/runtime/Dockerfile
Or you can just use it with nvidia-docker to create another container run all the stuff without touching your OS environments.
Wait so I'm seeing this in a basic chroot (drivers installed on the host and chroot.. trying to load steam)
what part of the Nvidia docker is fixing this? I don't want to use docker but I want 3d drivers.
VMware Ubuntu
2018/10/20 12:53:47 I1020 12:53:47.639172 3702 gymvnc.go:550] [0:localhost:5900] connection established
libGL error: unable to load driver: vmwgfx_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: vmwgfx
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Traceback (most recent call last):
universe-iizbj6-0 | [tigervnc] SConnection: Client needs protocol version 3.8
universe-iizbj6-0 | [tigervnc] SConnection: Client requests security type VncAuth(2)
When on CentOS7:
yum install -y mesa-libGLw-devel.x86_64
Thanks BuhuanJin, this solved a lot of problems.
I deal with it in Redhat-8.2 (aarch64) with installing the mesa driver:
sudo dnf install -y mesa-dri-drivers
Most helpful comment
You need the swrast driver installed for OpenGL rendering to work in headless mode. Typically,
apt-get intall -y mesa-utils and libgl1-mesa-glxwill do it. But if you have proprietary video drivers installed, it may take some googling to find the answer.