Write_image() faile with Scattermapbox

Hey all, having a lot of issues with Orca this past weekend trying to write_image() with a Scattermapbox. Was working flawlessly for a couple weeks and suddenly stopped working over this weekend. Lot of weird nuances with it so I will try and provide as much info as possible.

So a standard run of the program will just hang and produce:

Traceback (most recent call last):
File “test.py”, line 30, in
fig.write_image(“fig1.png”)
File “C:\Users\ _______\Miniconda3\lib\site-packages\plotly\basedatatypes.py”, line 2684, in write_image
return pio.write_image(self, *args, **kwargs)
File “C:\Users\ _______\Miniconda3\lib\site-packages\plotly\io_orca.py”, line 1704, in write_image
fig, format=format, scale=scale, width=width, height=height, validate=validate
File “C:\Users\ _______\Miniconda3\lib\site-packages\plotly\io_orca.py”, line 1528, in to_image
info=status_str
ValueError:
For some reason plotly.py was unable to communicate with the
local orca server process, even though the server process seems to be running.

Please review the process and connection information below:

state: running
executable: C:\Users\_______\Miniconda3\orca.CMD
version: 1.2.1
port: 8123
pid: 6524
command: ['C:\\Users\\_______\\Miniconda3\\orca.CMD', 'serve', '-p', '8123', '--plotly', 'C:\\Users\\_______\\Miniconda3\\lib\\site-packages\\plotly\\package_data\\plotly.min.js', '--graph-only', '--mathjax', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js', '--mapbox-access-token', '_______']

Following that, I tried the run the server manually to watch the output which returns:

{“severity”:“ERROR”,“textPayload”:“gpu process crashed - false”}
{“severity”:“ERROR”,“textPayload”:“renderer error - Uncaught TypeError: Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’: parameter 1 is not of type ‘WebGLShader’.”}
{“severity”:“ERROR”,“textPayload”:“renderer error - Uncaught TypeError: Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’: parameter 1 is not of type ‘WebGLShader’.”}
{“severity”:“ERROR”,“textPayload”:“renderer error - Uncaught TypeError: Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’: parameter 1 is not of type ‘WebGLShader’.”}
{“severity”:“ERROR”,“textPayload”:“525 - plotly.js error”,“labels”:{“fid”:null}}

Interestingly, if I run the server with “–debug”, and then try write_image(), the operation succeeds. On top of that, it is able to write_image() with every other type of graph I use which further adds to my confusion.

plotly 4.0.0
plotly-orca 1.2.1
psutil 5.6.3
Windows 10 (latest version)
GPU is updated to latest version

I have also tested the code on a work laptop which is also running Windows 10 and it has the same issues. For simplicity, I have been testing with https://plot.ly/python/scattermapbox/#basic-example

Any help is appreciated

Update for anyone else that encounters this issue, I figured out a hacky workaround to get the process working again.

Before you attempt to write_image() with a Scattermapbox, create a subprocess to manually launch the Plotly-orca server with the --keepalive option. For example,

subprocess.Popen([“orca”, “serve”, “-p”, “8123”, “–plotly plotly.min.js”, “–graph-only”, “–mathjax”, “https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js”, “–mapbox-access-token”, “tokentokentokentokentoken”, “–keep-alive”], stdout=subprocess.PIPE, shell=True)

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