Image export socket timeout

Hi everyone, I’m pretty new to plotly and orca, please let me know if i’m missing something!

When I try to use the to_image() method, which returns an image as an encoded string I get this error:

The image request was rejected by the orca conversion utility
with the following error:
   522: client socket timeout

It is somewhat inconsistent. Sometimes there is no problem, sometimes it doesn’t work at all even if the image is exactly the same.

The chart I am trying to plot is a scattermapbox, with a polygon layer.


I am trying to do this from a controller function (I’m using web2py), to serve a view which contains the images.
The error is more likely to occur when I try the export from the controller. When I do it locally from a script it usually goes well (as you can see above).

Edit: (I’m using python 2.7)

Hi @federicosilvestri,

I wonder if you’re running into the problem discussed in The first time you export an image the orca server process is launched, and attempts to communicate with it for up to 8 seconds. But if the server process takes longer than that to start up the first time, then the export fails.

We’re going to increase this time threshold in significantly in the next release (3.5.0), but in the meantime you can try to manually give the server process extra time to warm up by adding this to the top of your script/notebook:

import plotly
import time
time.sleep(10)  # Give orca server an extra 10 seconds to warm up


Hi @jmmease, thanks for your reply

I tried to give extra time but it didn’t work.

I run into this problem while generating a bunch of images: three are
regular scatterplots which have no problem, three are scattermapbox that give me this error.
I’ve tried manually launching the orca server on a port (8005) and setting = 8005

this way the server is already launched and i get to see the messages it generates:

{"severity":"ERROR","textPayload":"525 - plotly.js error","labels":{"fid":null}}

The first log is the error thrown by orca when it tries to generate the map image, the second is relative to the regular scatterplot, which succeeds.
The same thing happens other two times with these scatter/map pairs.

I was thinking it was the json size I’m passing to the map to be a problem, but I’ve tried also with the example from and I get the same error.

I’ve also seen that the to_image() method is more likely to generate the error than write_image().

Any ideas on what sould I try?

Thank you very much for your time

Hi @federicosilvestri, I hadn’t noticed last time that you were using scattermapbox traces. Have you configured orca with you mapbox access token? See

If not, give this a try: = 'your MAPBOX_TOKEN' # Persist config for future sessions


Hi @jmmease,
Yes, I had configured orca with my access token, in fact sometimes I was able to generate maps, but for some reason not anymore.

Could it be some limitations on number of export on the mapbox side?

Hi @federicosilvestri,
I suppose it’s possible it has something to do with the mapbox side.

Let’s try to reproduce the issue using the orca command-line utility directly, and then open an issue with the orca repo ( if we can.

First output a JSON representation of a simple mapbox figure that reproduces the issue with

import as pio
pio.write_json(fig, 'figure.json', pretty=True)

Then try exporting this JSON file to an image from the command line with

$ orca graph figure.json --mapbox-access-token YOUR_TOKEN -o figure.png

(you may need to replace orca with the full path to the orca executable depending on how your PATH is set up)

What happens for you in this case?

Hi @jmmease, sorry for the delay, here’s what’s happened when I tried what you suggested:
I’ve used the basic example of scattermapbox to ensure nothing else was influencing the output.

data = [

layout = go.Layout(

fig = dict(data=data, layout=layout)

#write json with
pio.write_json(fig, 'figure.json', pretty=True) 

Then in my terminal:

$ orca graph figure.json --mapbox-access-token MY_TOKEN -o figure.png --verbose

The output was this

gpu process crashed - false
          Chrome version 59.0.3071.115
          Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
          Chrome version 59.0.3071.115
          Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
          Chrome version 59.0.3071.115
          Electron version 1.8.4
renderer error - Uncaught TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'.
          Chrome version 59.0.3071.115
          Electron version 1.8.4

Anyway I tried again in generating the maps from my controller and I was able to generate multiple images:
Here are two examples (with custom json layers)



But then it stopped working after generating ~20 images.

Thanks again for your time

Hi @federicosilvestri,

I think the next step is to open an issue with the orca project and see if anyone can reproduce the issue ( Just include and include the example JSON file produced by your exaple and the console error messages you’re seeing.


Hi @jmmease, I’ll open an issue there and see what they can do



a possible solution to this seems to be upgrading to orca v1.2.1, where they addressed this problem. Could be useful to other users looking for answers here in the forum.

Two issues related to this problem


Thanks again for your time!

Awesome, thanks for following up @federicosilvestri!

this worked for me when i ran it for the third time. no idea why though