plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.

Home Page:https://plotly.com/dash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Error loading dependencies

WWakker opened this issue · comments

Describe your context

dash                      2.16.1
dash-bootstrap-components 1.5.0
dash-core-components      2.0.0
dash-daq                  0.5.0
dash-html-components      2.0.0
dash-iconify              0.1.2
dash-mantine-components   0.12.1
dash-table                5.0.0
  • if frontend related, tell us your Browser, Version and OS

    • OS: Windows
    • Browser Chrome

Describe the bug

I run this example app:

# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.


from dash import Dash, dcc, html
import plotly.express as px
import pandas as pd


app = Dash(__name__)

colors = {
    'background': '#111111',
    'text': '#7FDBFF'
}

# assume you have a "long-form" data frame
# see https://plotly.com/python/px-arguments/ for more options
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
})

fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")

fig.update_layout(
    plot_bgcolor=colors['background'],
    paper_bgcolor=colors['background'],
    font_color=colors['text']
)

app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
    html.H1(
        children='Hello Dash',
        style={
            'textAlign': 'center',
            'color': colors['text']
        }
    ),

    html.Div(children='Dash: A web application framework for your data.', style={
        'textAlign': 'center',
        'color': colors['text']
    }),

    dcc.Graph(
        id='example-graph-2',
        figure=fig
    )
])

if __name__ == '__main__':
    app.run(debug=True)

On startup, the app loads fine.

When I change something in my code, and the page reloads in the browser, I get the following error:
image

If I refresh the browser, the app loads again without problems.

This happens after upgrading my dash version, so could be related to a bug in the later versions.

Expected behavior

The page should reload without problems with debug=True.

Screenshots

See above

Update, when I downgrade to dash==2.15.0 it works fine. With 2.16.0 it fails again.

@WWakker This was fixed in 2.16.1

@AnnMarieW I'm afraid I'm still experiencing the issue with 2.16.1

When I change something in my code, and the page reloads in the browser, I get the following error:

It's a bug with newer version of orjson, dependencies now calls to_json for running to set components. When reloading the import on plotly.py seems to fail.
Can uninstall orjson or import orjson at the top.

Related to: plotly/plotly.py#3567

When I change something in my code, and the page reloads in the browser, I get the following error:

It's a bug with newer version of orjson, dependencies now calls to_json for running to set components. When reloading the import on plotly.py seems to fail. Can uninstall orjson or import orjson at the top.

Related to: plotly/plotly.py#3567

I confirm this, glad that it's not related to Dash

commented

Closing this because the issue is in Plotly.py

This issue should be resolved by the next Plotly.py release, now that the above linked PR has been merged.