I have an error saving a Mapbox plot

Hi community,
I created a figure using Choroplethmapbox and Scattermapbox.

fig = go.Figure(go.Choroplethmapbox(geojson=counties, locations=df_county.FIPS, z=df_county[‘Solar perc’],
colorscale=“Agsunset”, zmin=0, zmax=1,
marker_opacity=0.8, marker_line_width=0, marker_line_color=‘white’))
fig.update_layout(mapbox_style=“carto-positron”,
mapbox_zoom=3, mapbox_center = {“lat”: 37.0902, “lon”: -95.7129})
fig.add_trace( go.Scattermapbox(
lat=df_city[‘Latitude’],
lon=df_city[‘Longitude’],
mode=‘markers+text’,
marker=go.scattermapbox.Marker(
size=4,
color=‘black’,
opacity=1
),
text=df_city[‘Name’],
hoverinfo=‘text’))

Then, when I tried to save the figure using:
fig.write_image(“fig1.png”)
I met this error:
ValueError: Transform failed with error code 525: Mapbox error.
Can anyone help me solve this problem?
Thanks a lot.

Hey I have the same issue!

I’m making a figure with go.Scattermapbox() and I use something like this for the mapbox styling.

mapbox=dict(
                style='open-street-map',
                bearing=0,
                center=dict(
                    lon=case.network_n.geometry.x.mean(),
                    lat=case.network_n.geometry.y.mean()
                ),
                pitch=0,
                zoom=zoom,
            ),

Curiously I don’t get the error when I use fig.write_html(‘test.html’). Here is the full error I get:

self.case.maps.isystem().write_image('test3.jpg')
Traceback (most recent call last):
  File "C:\Users\908367\.conda\envs\wm\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-13-31575a24df1a>", line 1, in <module>
    self.case.maps.isystem().write_image('test3.jpg')
  File "C:\Users\908367\.conda\envs\wm\lib\site-packages\plotly\basedatatypes.py", line 3806, in write_image
    return pio.write_image(self, *args, **kwargs)
  File "C:\Users\908367\.conda\envs\wm\lib\site-packages\plotly\io\_kaleido.py", line 245, in write_image
    img_data = to_image(
  File "C:\Users\908367\.conda\envs\wm\lib\site-packages\plotly\io\_kaleido.py", line 131, in to_image
    img_bytes = scope.transform(
  File "C:\Users\908367\.conda\envs\wm\lib\site-packages\kaleido\scopes\plotly.py", line 111, in transform
    raise ValueError(
ValueError: Transform failed with error code 525: Mapbox error.

I use plotly version 4.14.3, Kaleido version 0.1.0

Did you ever figure out what the problem was, or does anyone else know what this error really means? because I don’t have the slightest clue where to start with fixing this.