44

I'm trying to setup a display but it's telling me No such file or directory.

Traceback (most recent call last):
  File "/var/www/envs/venv/proj/scripts/my_file.py", line 44, in click
    display = Display(visible=0, size=(800,600))
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 33, in __init__
    self._obj = self.display_class(
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/display.py", line 51, in display_class
    cls.check_installed()
  File "/usr/lib/python2.6/site-packages/pyvirtualdisplay/xvfb.py", line 38, in check_installed
    ubuntu_package=PACKAGE).check_installed()
  File "/usr/lib/python2.6/site-packages/easyprocess/__init__.py", line 209, in check_installed
    raise EasyProcessCheckInstalledError(self)
easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help']
OSError=[Errno 2] No such file or directory
Program install error!
User
  • 23,729
  • 38
  • 124
  • 207

2 Answers2

55

You likely need to install either the xvfb package, or possibly the xvfbwrapper:

First check and see if xvfb is installed:

Xvfb -help

If the command is not found then you can usually install the xvfb package with the following command (or whichever package manager you generally use):

sudo apt-get install xvfb

xvfbwrapper is Python wrapper for running a display inside X virtual framebuffer (Xvfb).

You can install it with:

pip install xvfbwrapper

The error you are getting seems to be a result of either the command or module not being found.

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • 1
    Hi, `pip install xvfbwrapper` does not seem to cut it on windows. Any ideas? – Bartek R. Apr 15 '16 at 09:32
  • 3
    @rojas, windows doesn't run X11. – Corey Goldberg Dec 27 '16 at 13:22
  • 3
    @BartekR. Just remove anything related to pyvirtualdisplay on Windows. You don't need it because of Windows graphics engine – rassa45 Nov 11 '17 at 20:14
  • Hi, I installed xvfb through Xquartz and I made sure it was correctly installed by `Xvfb - help`, but it still says it can't detect xvfb. Thanks – li.SQ Nov 27 '20 at 23:53
  • @li.SQ: How have you installed Xquartz? It uses its own window system, and in order to use xvfb with it I believe you would need to compile it from source using particular options which it would require. – l'L'l Nov 28 '20 at 00:53
  • @I'L'l Yes, I have installed Xquartz by installing the .pkg file. Can you explain "compile it from source"? – li.SQ Nov 28 '20 at 01:08
  • @li.SQ: Check the following link where it mentions `xorg-server`: https://www.xquartz.org/Developer-Info.html. If you can't figure it out then I would recommend posting a new question as your issue isn't really related to this question. – l'L'l Nov 28 '20 at 07:38
4

I encountered this error on a Mac and (finally) solved it by install Xquartz: https://www.xquartz.org/ (reboot after install!)

JuuLes87
  • 204
  • 3
  • 5