You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 27, 2026. It is now read-only.
Plotly can't find the xvfb-run executable when running from a Gunicorn Flask application. #252
Hi. I have installed Plotly and Orca with conda install -c plotly plotly-orca and xvfb with sudo apt-get install xvfb.
When running a Python script from the terminal that prints or saves a simple figure to file, it works, but when trying the same code from a Flask application running with Gunicorn and Nginx, it fails on .to_image
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1482, in to_image
ensure_server()
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1344, in ensure_server
validate_executable()
File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/plotly/io/_orca.py", line 1067, in validate_executable
formatted_path=formatted_path
ValueError:
The plotly.io.orca.config.use_xvfb property is set to True, but the
xvfb-run executable could not be found on the system path.
Searched for the executable 'xvfb-run' on the following path:
/home/ubuntu/anaconda3/bin
Inside /home/ubuntu/anaconda3/bin I have an orca.sh script with the following code:
#!/bin/bash
xvfb-run -a /home/ubuntu/anaconda3/bin/orca-1.2.1-x86_64.AppImage "$@"
The orca-1.2.1-x86_64.AppImage file is also present on that directory
Related: running orca on the terminal does not print anything, but xvfb-run orca graph '{ "data": [{"y": [1,2,1]}] }' -o fig.png does work.
here is my $path contents: /home/ubuntu/bin:/home/ubuntu/.local/bin:/home/ubuntu/anaconda3/bin:/home/ubuntu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Any help?
I'm a newbie with unix shell commands, btw.
tl;dr: Plotly can't find xvfb when running inside a Flask-Gunicorn app. Works fine when running from a simple python script from the terminal
I just found the solution. The issue was that my Gunicorn service configuration file was not receiving the correct path content.
In the section [Service], the Environment setting was set with only "PATH=/home/ubuntu/anaconda3/bin"
I updated the Environment with my whole $PATH content and now it works: "PATH=/home/ubuntu/bin:/home/ubuntu/.local/bin:/home/ubuntu/anaconda3/bin:/home/ubuntu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
Activity
VyMajoris commentedon Sep 27, 2019
I just found the solution. The issue was that my Gunicorn service configuration file was not receiving the correct path content.
In the section [Service], the
Environmentsetting was set with only"PATH=/home/ubuntu/anaconda3/bin"I updated the
Environmentwith my whole $PATH content and now it works:"PATH=/home/ubuntu/bin:/home/ubuntu/.local/bin:/home/ubuntu/anaconda3/bin:/home/ubuntu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"