-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support calling orca through xvfb on Linux #1523
Conversation
Using plotly.py with orca in Colab
from _plotly_future_ import v4
import plotly.io as pio
import plotly.graph_objs as go
fig = go.Figure(data=[{'y': [3, 2, 4]}])
pio.to_image(fig) |
orca setup for use in Kaggle kernels
If the Kaggle Python docker image (https://github.com/Kaggle/docker-python/blob/master/Dockerfile) was updated to include |
Unfortunately, it appears this approach won't work with Azure notebooks because sudo is required to use |
be used to run orca. May by True, False, or 'auto'. The default will be False until v4 (or when the orca_defaults future flag is enabled). In v4 the default will change to 'auto', in which case xvfb-run is used automatically if plotly.py is running on a Linux machine without a display server with xvfb-run available.
# Conflicts: # _plotly_future_/v4.py
Hi @jonmmease I installed orca using
According to this, I need to install So I tried the standalone orca binary route and downloaded orca-1.3.1.AppImage, made it executable and created a symbolic link named
I am not sure how to install FUSE on AWS linux, thus settled on trying AppImage with the Followed the I then tried
But
I also tried orca seems like a big hassle, cant find any help and use case examples beyond windows & ubuntu platform. No help on here nor stackoverflow nor plotly community. |
Overview
This PR adds support for calling orca through Xvfb, simplifying the process of using plotly.py's image export functions in a headless Linux environment.
This is accomplished through the addition of a new
use_xvfb
parameter inplotly.io.orca.config
. This parameter may be set toFalse
,True
, or'auto'
, where:False
: Never use xvfbTrue
: Use Xvfb and raise an error ifxvfb-run
is not found on the system Path'auto'
: Use Xvfb if running on Linux, no display serer is detected (determined by checking theDISPLAY
environment variable), andxvfb-run
is on the path.use_xvfb
will default toFalse
for the remainder of version 3, but it will default to'auto'
in version 4. The neworca_defaults
future flag may be used to enable this default behavior now.Usage
To perform headless static image export on Linux, first install orca following the instructions at https://github.com/plotly/orca#installation. Then install Xvfb using the package manager for your Linux distribution. Then configure plotly.py to call orca through Xvfb using:
Then export images as usual with:
Additional Changes
Add
LD_PRELOAD
to the list of environment variables to be excluded to be unset when calling orca to avoid breaking orca in Colab (See https://medium.com/@n0mad/how-i-trained-starcraft-2-ais-using-googles-free-gpus-44bc635b0418 for discussion of the Colab's use of tcmalloc).