Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Headless servers Opengym AI rendering Error while using ray

While using ray for distributed computation, all the servers are headless (no display). Therefore, using "xvfb-run -s “-screen 0 1400x900x24” to create screen.

Getting error pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to “None”

Without ray using only 1 machine, this command works perfectly. "xvfb-run -s “-screen 0 1400x900x24”

In conclusion, xvfb-run doesn’t work with ray distribution.

Does Ray require extra configuration to achieve this? Is there any other way I can get past this error? I am working on a Car Racing environment from open gym ai which triggers rendering.

like image 699
Harshit Gupta Avatar asked Sep 03 '25 03:09

Harshit Gupta


1 Answers

I stumbled upon a similar problem, although running a Python script, but also with the CarRacinv-v0 environment.

What worked for me was this

import gym
import pyvirtualdisplay


# Creates a virtual display for OpenAI gym
pyvirtualdisplay.Display(visible=0, size=(1400, 900)).start()


env = gym.make('CarRacing-v0')
env.reset() # This line failed without the display setup
like image 165
ponadto Avatar answered Sep 06 '25 03:09

ponadto