plotly / plotly/Kaleido

Error saving a mapbox element to png

Open
#83 23 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

active bug
Dominant language
Python
Stars
498
Forks
62
Avg merge
1d 11h
Merged PRs (30d)
2

Description

Hello, recently the option of saving a fig with a mapbox element to a png file started to fail with the error:

ValueError: Transform failed with error code 525: Mapbox error.

The funny thing is that this exact same option worked just fine until a few days ago. The same error occurs when passing a mapbox token (even though the token is not mandatory for mapbox_style="open-street-map").

When trying to figure out what was the problem I reached this line in the source code, but I have no idea what is the solution.

Bellow a code block from the examples page that raises the same error:

import pandas as pd
us_cities = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv")

import plotly.express as px

fig = px.scatter_mapbox(us_cities, lat="lat", lon="lon", hover_name="City", hover_data=["State", "Population"],
                        color_discrete_sequence=["fuchsia"], zoom=3, height=300)
fig.update_layout(mapbox_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})

# fig.show()
fig.write_image('/tmp/test.jpg')

Using:
plotly.version: 4.14.3
kaleido.version: 0.2.1

Thank you.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with repos/kaleido/py/kaleido/scopes/base.py at line 308 and run the supplied Plotly Express reproduction using Plotly 4.14.3 and Kaleido 0.2.1. Compare the open-street-map case with and without a Mapbox token; done means fig.write_image succeeds for the reported example without the Mapbox error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.