evogym icon indicating copy to clipboard operation
evogym copied to clipboard

Error in running python gym_test.py

Open ShuleiLiu opened this issue 3 years ago • 2 comments

In a terminal, when i cd to the examples folder and run gym_test.py, I get

Using Evolution Gym Simulator v2.2.5 Error initializing GLFW. Segmentation fault (core dumped)

My OS is Ubuntu 18.04.4 LTS.

ShuleiLiu avatar Jul 05 '22 02:07 ShuleiLiu

In a terminal, when i cd to the examples folder and run gym_test.py, I get

Using Evolution Gym Simulator v2.2.5 Error initializing GLFW. Segmentation fault (core dumped)

My OS is Ubuntu 18.04.4 LTS.

I think you can delete the code "env.render()" to disable rendering the environment.

Yuxing-Wang-THU avatar Jul 07 '22 10:07 Yuxing-Wang-THU

I had the same error when I tried to run the example on a headless server. The solution I came up with is to use xvfb. It can be installed with sudo apt-get install xvfb. Then you can run the script with xvfb-run python gym_test.py. I believe xvfb creates a virtual x server and rendering is done using that.

mertan-a avatar Jul 10 '22 17:07 mertan-a

@Yuxing-Wang-THU is exactly right. EvoGym was designed so that the rendering libraries are initialized on the first call to .render(). This was done so that training can be run on a headless server.

Thanks @mertan-a for the cool solution!

Closing this for now, please let me know if further issues persist.

jagdeepsb avatar Feb 12 '23 19:02 jagdeepsb

I have a similar issue, however, xvfb-run python gym_test.py didn't solve it. (I am using WSL 2, Ubuntu 22.04.4 LTS) This is the error (with and without xvfb):

Using Evolution Gym Simulator v2.2.5 libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) libGL error: failed to load driver: swrast GLFW failed to create rendering winidow. Segmentation fault

But apt-file search swrast_dri.so shows:

libgl1-mesa-dri: /usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so libgl1-mesa-dri: /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so

Thank you for your help

JohnStewardson avatar Mar 06 '24 14:03 JohnStewardson