question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conversion fails with Scattergl

See original GitHub issue

If I want to create an offline plot that contains the plotly Scattergl command I get an error message.

Consider the example below (which is run through a jupyter notebook with linux host and windows guest):

import plotly.io as pio
import plotly.graph_objs as go

traces = []

traces.append(
    go.Scattergl(
        y=[1, 3, 2]))

layout = go.Layout(
    width=800)

fig = go.Figure(data=traces, layout=layout)

# Plot and embed in ipython notebook
pio.write_image(fig, "simple_fig.png")

This will give the following error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-10-92d1a9d074fc> in <module>()
     14 
     15 # Plot and embed in ipython notebook
---> 16 pio.write_image(fig, "simple_fig.png")

~/usr/local/lib/python3.6/site-packages/plotly/io/_orca.py in write_image(fig, file, format, scale, width, height, validate)
   1483                         width=width,
   1484                         height=height,
-> 1485                         validate=validate)
   1486 
   1487     # Open file

~/usr/local/lib/python3.6/site-packages/plotly/io/_orca.py in to_image(fig, format, width, height, scale, validate)
   1388 Unfortunately, we don't yet know of an easy way to install poppler on Windows.
   1389 """
-> 1390         raise ValueError(err_message)
   1391 
   1392 

ValueError: 
The image request was rejected by the orca conversion utility
with the following error:
   525: plotly.js error

Changing Scattergl to Scatter will make the example work.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gmrukwacommented, Sep 15, 2019

I have the same problem. I export my plotly.express scatter plots to JSON, where I replace scattergl with scatter as a workaround and generate my .png files. I will experiment with this a bit longer for more elegant solution, but I already wasted several hours on basic plot dumps due to this issue. I tested all the proposed solutions, like

import plotly.io as pio
pio.orca.config.use_xvfb = True

etc., but none of them works.

BTW, README.md in repo root claims that default port for orca is 9091, while plotly randomly sets the port each time. That’s super unclear when using it in remote Docker containers (SSH with port forwarding & Docker on remote machine).

0reactions
Nikolai-Hlubekcommented, Jun 21, 2019

Dear @jonmmease

Thanks for your help. I tried your suggestion and have orca and Xvfb in the path.

$ which orca
~/usr/local/bin/orca
$ which Xvfb
/usr/bin/Xvfb
$ ls -hal ~/usr/local/bin/orca
... /home/nhlubek/usr/local/bin/orca -> /home/nhlubek/plotly-orca/orca-1.2.1-x86_64.AppImage

However I still get the same error messages as above when I run the scripts via jupyter or directly on the linux host.

Additionally after trying to run the commands a few times, opening and closing the notebook I’m left with the following processes:

16494 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --help
16538 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --version
16579 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca serve -p 37472 --plotly /home/nhlubek/usr/local/lib/python3.6
16711 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
16712 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
16713 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
16735 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --help
16775 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --version
16819 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca serve -p 38772 --plotly /home/nhlubek/usr/local/lib/python3.6
16925 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
16945 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --help
16990 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --version
17038 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca serve -p 43606 --plotly /home/nhlubek/usr/local/lib/python3.6
17206 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --help
17251 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca --version
17292 ?        Ss     0:00 /home/nhlubek/usr/local/bin/orca serve -p 45273 --plotly /home/nhlubek/usr/local/lib/python3.6
Read more comments on GitHub >

github_iconTop Results From Across the Web

plotly.graph_objects.Scattergl — 5.11.0 documentation
Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data. The 'array' property is an...
Read more >
Python Figure Reference: scattergl Traces - Plotly
Scattergl trace is a graph object in the figure's data list with any of ... If the axis `type` is "date", then you...
Read more >
When I'm plotting bubble chart in plotly I'm getting an error
I'm getting this error. Invalid element(s) received for the 'size' property of scattergl.marker Invalid elements include: [nan, nan, nan, ...
Read more >
Visualization with Plotly.Express: Comprehensive guide
Luckily python and pandas library allows converting between these ... can try to pick one of the columns, but the result is a...
Read more >
Python Plotly - How to add multiple Y-axes? - GeeksforGeeks
Python-Plotly · Python. Practice Tags : python. Improve Article. Report Issue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found