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.

1 Like

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

1 Like

@bjodah, I would like to know how can I do the same.
I have never worked with xvfb (run).
Actually, I don’t even know what that is.
Can you, please, give me some more detail?
I get the error at a specific image. Every other image works just fine!

Thanks!

It’s very important that you not have a file named plotly.py in the same directory as the Python script you’re running, and this includes not naming the script itself plotly.py, otherwise importing plotly can fail with mysterious error messages.

Beyond this, most import problems or AttributeErrors can be traced back to having multiple versions of plotly installed, for example once with conda and once with pip. It’s often worthwhile to uninstall with both methods before following the Getting Started instructions from scratch with one or the other. You can run the following commands in a terminal to fully remove plotly before installing again:

conda uninstall plotly pip uninstall plotly

Regards,
Rachel Gomez