Search code examples
python-3.xx11pyvirtualdisplay

How to resolve XStartTimeoutError: Failed to start X on display ":1013" error


I want to run a pyvirtualdisplay on my Mac.

After installing all dependencies I installed X11 because i needed Xvfb to run and changed some permission for some folder called ~/.Xauthority to 777.

Still, if I ran

display = pyvirtualdisplay.Display(visible=0, size=(320, 240)).start()

XStartTimeoutError: Failed to start X on display ":1013" (xdpyinfo check failed).

What I also tryed was to change X11Forwarding in my /etc/ssh/sshd_config file to yes. Did not work out.

How can I resolve the issue?

Constructive help appreciated.


Solution

  • I got this same error while trying to run Selenium using PyVirtualDisplay on my Raspberry Pi. I was not running Xephyr.

    In a separate terminal window I ran

    export DISPLAY=:0 XAUTHORITY=/etc/X11/host-Xauthority
    

    and then

    Xephyr :1 -fullscreen
    

    Then re ran my python script and it worked.

    If that doesn't work for you, here is where the actual error is occurring in the PyVirtualDisplay package: https://github.com/ponty/PyVirtualDisplay/blob/d229fcf892fdda17887684b977365d1fa90255eb/pyvirtualdisplay/abstractdisplay.py#L149

    As you can see, you might need to install xdpyinfo in some form on your Mac.