525: plotly.js error

I’m trying to save an image offline in a Docker container for my discord bot. It works on my local machine but running the same code in the container I get this error:

/opt/conda/bin/orca: line 11:    76 Terminated              xvfb-run -a /opt/conda/bin/plotly-orca "$@"
Traceback (most recent call last):
  File "bot/discordBot.py", line 15, in <module>
    import chart as c
  File "/bot/chart.py", line 91, in <module>
    print(get_plot("BTC"))
  File "/bot/chart.py", line 85, in get_plot
    pio.write_image(fig, 'fig1.png', validate=True)
  File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1512, in write_image
    validate=validate)
  File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1417, in to_image
    raise ValueError(err_message)
ValueError:
The image request was rejected by the orca conversion utility
with the following error:
   525: plotly.js error

Yet, running this code gives me an output without error:

pio.write_image(go.Figure(data=[{'y': [1, 3, 2]}]), 'simple_fig.png')

How should I go about debugging this error? seems odd that the docker container is giving me issues but not my local machine.

Hi @Shaarawi,

It might be helpful to compare your docker config with the the one the official config that used by chart studio: https://github.com/plotly/orca/blob/master/deployment/Dockerfile.

Also, the orca team is also in the process of publishing an official docker image in https://github.com/plotly/orca/pull/222.

in terms of debugging, I think I’d recommend trying out the image from that PR and see if that works in your environment (not necessarily from plotly.py, just running from the command line would be enough). Then work your way backwards to the configuration you want alongside discord.

Another idea. You could start the orca server in debug mode from the command line inside your docker container and see if you get any more informative error messages.

Something like

$ xvfb-run -a orca serve --debug

-Jon

Hey @jmmease,

So funny enough I tried that exact docker config and orca isn’t being recognized. My config runs fine normally since orca --help works as intended and pio.write_image(go.Figure(data=[{'y': [1, 3, 2]}]), 'simple_fig.png')
works as well. --debug unfortunately didn’t provide any useful information.

I’m more focused on why this error is coming up for my own figure

File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1512, in write_image
**validate=validate**)
  File "/opt/conda/lib/python3.7/site-packages/plotly/io/_orca.py", line 1417, in to_image
raise ValueError(err_message)
ValueError:
The image request was rejected by the orca conversion utility
with the following error:
   **525: plotly.js error**

looking at the functions write_image and to_image in https://github.com/plotly/plotly.py/blob/master/plotly/io/_orca.py

I can’t find why my code would raise an error. I don’t use map box so the 525 error shouldn’t be raised.

Ok, interesting so you can successfully write out this simple figure to an image? I think I miseed that before. What kind of traces do you have in your figure? I’m particularly wondering if there are any mapbox or WebGL accelerated trace types.

FWIW, the error message is raised in render function in orca at https://github.com/plotly/orca/blob/4b2310dc7a82f13434e082934dbf3ef69b1e7cb5/src/component/plotly-graph/render.js.

-Jon

I was facing this probelm as well, I needed to add server args to xvfb run:

xvfb-run --server-args “-screen 0 1920x1080x24” -a /home/bjorn/Downloads/orca-1.2.1-x86_64.AppImage “$@”

xref: https://github.com/plotly/orca/issues/223

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online