question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

xvfb-run: error: Xvfb failed to start

See original GitHub issue

I am able to reproduce the error with the following minimal code:

import plotly.io as pio
import numpy as np
import plotly.graph_objs as go


N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N)*30

fig = go.Figure()
fig.add_scatter(x=x,
                y=y,
                mode='markers',
                marker={'size': sz,
                        'color': colors,
                        'opacity': 0.6,
                        'colorscale': 'Viridis'})

pio.write_image(fig, 'plot.png')

To which I get the following error:

❯ python orca_bug.py 
Traceback (most recent call last):
  File "orca_bug.py", line 21, in <module>
    pio.write_image(fig, 'plot.png')
  File "/home/ethanbro/virtualenvs/598/lib/python3.6/site-packages/plotly/io/_orca.py", line 1492, in write_image
    validate=validate)
  File "/home/ethanbro/virtualenvs/598/lib/python3.6/site-packages/plotly/io/_orca.py", line 1263, in to_image
    ensure_server()
  File "/home/ethanbro/virtualenvs/598/lib/python3.6/site-packages/plotly/io/_orca.py", line 1134, in ensure_server
    validate_executable()
  File "/home/ethanbro/virtualenvs/598/lib/python3.6/site-packages/plotly/io/_orca.py", line 1001, in validate_executable
    returncode=p.returncode))
ValueError: 
The orca executable is required in order to export figures as static images,
but the executable that was found at '/usr/local/bin/orca'
does not seem to be a valid plotly orca executable. Please refer to the end of
this message for details on what went wrong.

If you haven't installed orca yet, you can do so using conda as follows:

    $ conda install -c plotly plotly-orca

Alternatively, see other installation methods in the orca project README at
https://github.com/plotly/orca.

After installation is complete, no further configuration should be needed. 

If you have installed orca, then for some reason plotly.py was unable to
locate it. In this case, set the `plotly.io.orca.config.executable`
property to the full path of your orca executable. For example:

    >>> plotly.io.orca.config.executable = '/path/to/orca'

After updating this executable property, try the export operation again.
If it is successful then you may want to save this configuration so that it
will be applied automatically in future sessions. You can do this as follows:

    >>> plotly.io.orca.config.save() 

If you're still having trouble, feel free to ask for help on the forums at
https://community.plot.ly/c/api/python

An error occurred while trying to get the version of the orca executable.
Here is the command that plotly.py ran to request the version
    $ /usr/local/bin/orca --version

This command returned the following error:

[Return code: 1]
xvfb-run: error: Xvfb failed to start

I am running headless so I use xvfb-run:

❯ cat $(which orca)
#!/bin/zsh

xvfb-run /usr/local/lib/node_modules/orca/orca-1.1.1-x86_64.AppImage "$@"

Using Ubuntu 18:

❯ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.1 LTS
Release:	18.04
Codename:	bionic

Weirdly, I do not get the error when I run /usr/local/bin/orca --version:

❯  /usr/local/bin/orca --version
desktop-file-install is missing. Skipping /tmp/.mount_orca-1Pimrny/AppRun.
1.1.1

Not sure what the other stuff is about.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
Ejdammcommented, Nov 27, 2018

Manpages says

-a, --auto-servernum Try to get a free server number, starting at 99, or the argument to --server-num.

So if there is already a xvfb-instance running and the -a flag is not set they will both try to connect with server number 99. With the -a flag enabled the second instance will try to get server number 100++ instead.

I also use headless ubuntu 18.04 and had the same problem. I tracked it down to validate_executable() in _orca.py (https://github.com/plotly/plotly.py/blob/master/plotly/io/_orca.py#L841). It validates the orca executable by first calling orca --help and then orca --version directly after. If they are run with xfvb the first run will go well but it doesn’t have enough time to exit before the second is called, So orca --version tries to connect with servernumber 99 which is already taken and returns an error, making orca believe the wrong orca executable is installed.

1reaction
ethanabrookscommented, Sep 18, 2018
❯ xvfb-run orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png
xvfb-run: error: Xvfb failed to start
Read more comments on GitHub >

github_iconTop Results From Across the Web

Xvfb failed start error - Stack Overflow
I was getting this error "xvfb-run: error: Xvfb failed to start" on Ubuntu 14.04, where previously my script had run without problems on...
Read more >
Xvfb failed to start - Katalon Studio
Hello,. Has anyone been facing this issue with docker. atalon | Mozilla Firefox 81.0 katalon | Katalon Studio
Read more >
error: Xvfb failed to start" in make tests causes Travis to ...
which says the solution is: Use `-a` option to `xvfb-run` so that it selects a free display automatically and starts the server. Do...
Read more >
xvfb-run: Xvfb failed to start – MagicPod Help Center
Run ps aux | grep vfb, and if the Xvfb-related process still running, kill it before trying the operation again. If you still...
Read more >
Issue 35240: Travis CI: xvfb-run: error: Xvfb failed to start
Travis CI fails randomly with "xvfb-run: error: Xvfb failed to start". Example: https://travis-ci.org/python/cpython/jobs/454776965 whereas the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found