Closed taochenshh closed 7 years ago
This is most likely because OpenGL is unable to create a window because tensorflow has grabbed the GPU. You didn't mention what OS, OpenGL or X server you're using, but on Linux you can usually work around this by setting the environment variable LIBGL_ALWAYS_SOFTWARE=1.
You can also prevent TensorFlow from grabbing GPU by doing "export CUDA_VISIBLE_DEVICES="
@tlbtlbtlb Thanks, do you mean I enter export LIBGL_ALWAYS_SOFTWARE=1
in the terminal? I tried this and it did not work. BTW, I used ubuntu 14.04.
And when I ran glxinfo | grep 'version'
, I got:
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.3.0 NVIDIA 367.57
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL version string: 4.5.0 NVIDIA 367.57
OpenGL shading language version string: 4.50 NVIDIA
Do I need to install any software to make LIBGL_ALWAYS_SOFTWARE=1
work?
@yaroslavvb Thanks, but what if I wanna use tensorflow with GPU while using gym simultaneously? Actually, if I only import tensorflor, no error occurred. Error only occurred when I import tflearn before calling env.render(). And no error occurred either if I import tflearn after env.render()
It may also fix it to import pyglet
before tensorflow
, which is cleaner than trying to call env.render
first.
Is there a better fix for this problem. I'm seeing it on Linux Ubuntu 16.04. I'm up to date with the latest patches etc, and I tried all of the above and more and it's still crashing similiar to the OP. Any help is appreciated. I get the stack trace:
/usr/bin/python3.6 /home/pmerrill/pycharm/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 42703 --file /home/pmerrill/dev/openai/baselines/baselines/ddpg/main.py pydev debugger: process 11603 is connecting
Connected to pydev debugger (build 172.4343.24)
Traceback (most recent call last):
File "/home/pmerrill/pycharm/helpers/pydev/pydevd.py", line 1599, in
Process finished with exit code 1
Ok I figured it out. I need to install gym using python3. I had followed the docs which for me installed for python2.7 on the command line. In my IDE(pycharm) I was using python3 When I installed gym with pip3 then things were set up correctly and the crash went away. Hope this helps others.
I just used the following code. And the code ran fine when
import tflearn
was commented. If I have bothimport tflearn
andenv.render()
, error occurred.The error is like this: