orca icon indicating copy to clipboard operation
orca copied to clipboard

Orca failing on cronned execution

Open crzchris opened this issue 6 years ago • 3 comments

I have a notebook that uses orca to save images. I run it in a bash script that activates all the necessary environments. When running from the command line, it works fine, but if I run the same script from cron it fails at

plotly.io.orca.ensure_server()

for

The orca executable is required in order to export figures as static images, but the executable that was found at '/home/user/miniconda3/envs/env_run/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.

Using npm env

cd "$(dirname "$0")"

source env_run/bin/activate source env_njs/bin/activate

papermill report_py.ipynb out.ipynb -p param $1

Using conda

cd "$(dirname "$0")"

source activate env_run

papermill report_py.ipynb out.ipynb -p param $1

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'

I set the path to the orca executable in the notebook. It finds the right executable. But for some reason it fails for above. The crontab is under the same user and has all the required permissions. Why does the same orca.js work when running from command line and fail when run by crontab?

crzchris avatar May 31 '19 06:05 crzchris

Hi @crzchris,

Are you saying the Using npm env / Using conda lines are part of the error message? This doesn't look familiar. Could you copy and paste the entire stack trace and error message. Thanks

jonmmease avatar Jun 15 '19 12:06 jonmmease

Orca version using is 1.2.1 Python version 2.7

From Pycharm or CLI if i run the code no issues but if we from crontab issue occurring

Even i have tried giving the path and save as per below error message but luck.

TraceMsg:

The orca executable is required in order to export figures as static images, but the executable that was found at '/usr/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

Here is the error that was returned by the command $ /usr/bin/orca --help

[Return code: 1]

Note: When used on Linux, orca requires an X11 display server, but none was detected. Please install Xvfb and configure plotly.py to run orca using Xvfb as follows:

>>> import plotly.io as pio
>>> pio.orca.config.use_xvfb = True

You can save this configuration for use in future sessions as follows:

>>> pio.orca.config.save() 

See https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml for more info on Xvfb

Thanks

Sivajida00 avatar Jun 30 '20 11:06 Sivajida00

@Sivajida00 I just want to mention that we're basically replacing Orca with the new Kaleido project (https://github.com/plotly/Kaleido) which is significantly easier to install in docker containers and is our new recommended way forward for this kind of thing :)

antoinerg avatar Jan 04 '21 19:01 antoinerg