2

I'm running a co-workers notebook on my local machine (she used collab).

Immediately after import, this line of code

display = pyvirtualdisplay.Display(visible=0, size=(1400, 900))
_ = display.start()

causes this error (abbreviated, it's pages long):

~/opt/anaconda3/envs/general-ml/lib/python3.8/site-packages/pyvirtualdisplay/abstractdisplay.py in _wait_for_pipe_text(self, rfd)
    293             (rfd_changed_ls, _, _) = select.select([rfd], [], [], 0.1)
    294             if not self.is_alive():
--> 295                 raise XStartError(
    296                     "%s program closed. command: %s stderr: %s"
    297                     % (self._program, self._command, self.stderr)

XStartError: Xvfb program closed. command: ['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1400x900x24', '-displayfd', '67'] stderr: b'_XSERVTransmkdir: 
ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local\n_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
_XSERVTransSocketUNIXCreateListener: mkdir(/tmp/.X11-unix) failed, errno = 2
_XSERVTransMakeAllCOTSServerListeners: failed to create listener for local
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created

... AND ON AND ON FOREVER.

I used conda to install the pyvirtualdisplay package and installed Xvfb from Xquarts.

Both of these tools are brand new to me, so I barely know what they do. I'm trying to get this notebook to run so I can learn a bit more but I'm stuck before I even started.

rocksNwaves
  • 5,331
  • 4
  • 38
  • 77

1 Answers1

5

I had a similar error on my M1 MacBook Pro, and I couldn't find any fix online. I ended up solving it by downloading XQuartz and running it:

xhost +

I hope it will help anybody.

Aviv Dolev
  • 140
  • 3
  • 14
  • Thank you for this answer. What does the "xhost +" command do though? – Cyebukayire May 10 '23 at 08:56
  • @Cyebukayire The error message indicates that the directory "/tmp/.X11-unix" (related to the X server used by pyvirtualdisplay) cannot be created. The error "euid != 0" typically indicates insufficient privileges. Running the "xhost +" command disables access control restrictions on the X server, potentially resolving the issue. – Aviv Dolev May 16 '23 at 09:13