title: Display not working with pyvirtualdisplay: "XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed)"
body: <p>I am using macOS Mojave and trying to run the following:</p>
  
  <pre><code>import torch
  import torch.nn as nn
  import torch.nn.functional as F 
  from torch import optim
  import numpy as np
  import pandas as pd
  
  import matplotlib.pyplot as plt
  import seaborn as sns
  from pyvirtualdisplay import Display
  from IPython import display as ipythondisplay
  from IPython.display import clear_output
  from pathlib import Path
  
  import random, os.path, math, glob, csv, base64, itertools, sys
  import gym
  from gym.wrappers import Monitor
  from pprint import pprint
  
  # The following code is will be used to visualize the environments.
  
  def show_video(directory):
      html = []
      for mp4 in Path(directory).glob("*.mp4"):
          video_b64 = base64.b64encode(mp4.read_bytes())
          html.append('''&lt;video alt="{}" autoplay 
                        loop controls style="height: 400px;"&gt;
                        &lt;source src="data:video/mp4;base64,{}" type="video/mp4" /&gt;
                   &lt;/video&gt;'''.format(mp4, video_b64.decode('ascii')))
      ipythondisplay.display(ipythondisplay.HTML(data="&lt;br&gt;".join(html)))
  
  display = Display(visible=0, size=(1400, 900))
  display.start();
  
  </code></pre>
  
  <p>But when I try to run the above, I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  XStartTimeoutError                        Traceback (most recent call last)
  &lt;ipython-input-1-73a977c6bd7e&gt; in &lt;module&gt;
       31 
       32 display = Display(visible=0, size=(1400, 900))
  ---&gt; 33 display.start();
       34 
       35 def make_seed(seed):
  
  /usr/local/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py in start(self)
      166         if not ok:
      167             msg = 'Failed to start X on display "%s" (xdpyinfo check failed).'
  --&gt; 168             raise XStartTimeoutError(msg % d)
      169         return self
      170 
  
  XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed).
  
  </code></pre>
  
  <p>The only close thing I get is <a href="https://unix.stackexchange.com/questions/215558/why-am-i-getting-this-message-from-xauth-timeout-in-locking-authority-file-ho">Why am I getting this message from xauth: “timeout in locking authority file /home//.Xauthority”?
  </a></p>
  
  <p>which is not really what I am facing here. How can I fix this issue?</p>