Headless Eevee rendering
This may work (not quite knowing the context):

!apt-get install python-opengl -y

!apt install xvfb -y

!pip install pyvirtualdisplay

!pip install piglet


from pyvirtualdisplay import Display
Display().start()




And you may not need piglet and xvfb, I have yet to test.

Source:
Answer by Shrawan Agrawal
https://stackoverflow.com/questions/50107530/how-to-render-openai-gym-in-google-colab