ponty / PyVirtualDisplay

Python wrapper for Xvfb, Xephyr and Xvnc
BSD 2-Clause "Simplified" License
697 stars 78 forks source link

Issues with wsl2 + win11 #84

Open Victornovikov opened 1 year ago

Victornovikov commented 1 year ago

I am trying to run the following example

from pyvirtualdisplay import Display
with Display() as disp:
    # display is active
    print(disp.is_alive()) # True
# display is stopped
print(disp.is_alive()) # False

This results in

 XStartTimeoutError
No reply from program Xvfb. command:['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1400x900x24', '-displayfd', '14']
  File "/home/vn/marl-interfere/render_mpe.py", line 134, in main
    virtual_display.start()
  File "/home/vn/marl-interfere/render_mpe.py", line 144, in <module>
    main(sys.argv[1:])
pyvirtualdisplay.abstractdisplay.XStartTimeoutError: No reply from program Xvfb. command:['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1400x900x24', '-displayfd', '14']

xfvb is running on the wsl2

 xdpyinfo -display :0 >/dev/null 2>&1 && echo "In use" || echo "Free"
In use

I'd appreciate any suggestions.

ponty commented 1 year ago

Sorry I have no wsl and I had no feedback of Windows usage. You can try this environment variable:

PYVIRTUALDISPLAY_DISPLAYFD=0

VishnuSuresh2000 commented 11 months ago

On settings up the above environment variable it is working for me in Ubuntu 20.04 WSL2 + Windows 10

ponty commented 10 months ago

So the -displayfd flag has some problem on this config. Please test it https://stackoverflow.com/questions/2520704/find-a-free-x11-display-number/

This is my test on Ubuntu 22.04

exec 6>display.log
Xvfb -displayfd 6

other terminal

cat display.log 
1
GitFogux commented 8 months ago

On my Ubuntu 20.04 WSL 2 + Windows 11 (had the exact same issue and using PYVIRTUALDISPLAY_DISPLAYFD=0 fixed it)

Running :

exec 6>display.log
Xvfb -displayfd 6

creates an empty display.log file The console in which I run this outputs a bunch of lines, the last of which read :

_XSERVTransOpen: transport open failed for unix/URANUS:59531
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for unix
_XSERVTransSocketOpenCOTSServer: Unable to open socket for unix
_XSERVTransOpen: transport open failed for unix/URANUS:59532
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for unix
_XSERVTransSocketOpenCOTSServer: Unable to open socket for unix
_XSERVTransOpen: transport open failed for unix/URANUS:59533
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for unix
_XSERVTransSocketOpenCOTSServer: Unable to open socket for unix
_XSERVTransOpen: transport open failed for unix/URANUS:59534
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for unix
_XSERVTransSocketOpenCOTSServer: Unable to open socket for unix
_XSERVTransOpen: transport open failed for unix/URANUS:59535
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for unix
(EE)
Fatal server error:
(EE) Failed to find a socket to listen on(EE)