title: (using 'imgkit' on Ubuntu server) wkhtmltopdf: could not connect to any X display
body: <p>I have a python script running on a remote Ubuntu server. At some point in my code, I create an HTML file which I then convert to a png. I therefore elected to use imgkit, which does the job beautifully well (I tested my code on my Mac OS before uploading the python script to the remote Ubuntu server):</p>
  
  <pre><code>import imgkit
  
  imgkit.from_url('MyFile.html', 'MyFile.png')
  </code></pre>
  
  <p>Now, the problem is that the Ubuntu server did not have imgkit and wkhtmltopdf installed. So I ran the following command:</p>
  
  <pre><code>sudo pip install imgkit
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>sudo apt-get install wkhtmltopdf
  </code></pre>
  
  <p>Then it returned the error:</p>
  
  <pre><code>QXcbConnection: Could not connect to display 
  Could not connect to any X display.
  
  
  You need to install xvfb(sudo apt-get install xvfb, yum install xorg-x11-server-Xvfb, etc), 
  then add option: {"xvfb": ""}.
  </code></pre>
  
  <p>So far so good. I therefore ran the following command:</p>
  
  <pre><code>sudo apt-get install xvfb
  </code></pre>
  
  <p>Which worked. But the Ubuntu server is still returning the same error. Now, for one thing, I have no idea what: <code>then add option: {"xvfb": ""}.</code> even means. I tried to look for answers online and people quoted that before, without explaining what one should actually do or write in the terminal. I also feel that I am missing extensions for wkhtmltopdf but I am not sure which (again, I ran an online search but I am more confused than anything else at this point. I found similar threads on stack overflow, but nothing quite like the problem I am experiencing). Any help would be deeply appreciated.</p>
  
  <p>Thank you so very much
  Best regards,
  Berti</p>