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:
ValueError:
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).
I wonder if you’re running into the problem discussed in https://github.com/plotly/orca/issues/164#issuecomment-444454487. The first time you export an image the orca server process is launched, and plotly.py 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
plotly.io.orca.ensure_server()
time.sleep(10) # Give orca server an extra 10 seconds to warm up
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 plotly.io.orca.config.port = 8005
this way the server is already launched and i get to see the messages it generates:
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 https://plot.ly/python/scattermapbox/ 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().
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 (https://github.com/plotly/orca) if we can.
First output a JSON representation of a simple mapbox figure that reproduces the issue with
import plotly.io as pio
pio.write_json(fig, 'figure.json', pretty=True)
Then try exporting this JSON file to an image from the command line with
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.
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.
I think the next step is to open an issue with the orca project and see if anyone can reproduce the issue (https://github.com/plotly/orca/issues)? Just include and include the example JSON file produced by your exaple and the console error messages you’re seeing.
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.