nayant
nayant

Reputation: 21

Getting error loading dependencies in chrome browser, when running plotly dash code

I am new to plotly dash and trying to run this googled code to understand the output. When i run the below code in windows cmd prompt, the execution returns the URL-- http://127.0.0.1:3003 On pasting the above in Chrome browser, error loading dependencies is displayed in the browser window. Please find below the code.

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import pandas as pd


df = pd.read_excel(
    "https://github.com/chris1610/pbpython/blob/master/data/salesfunnel.xlsx?raw=True"
)

pv = pd.pivot_table(df, index=['Name'], columns=["Status"], values=['Quantity'], aggfunc=sum, fill_value=0)


trace1 = go.Bar(x=pv.index, y=pv[('Quantity', 'declined')], name='Declined')
trace2 = go.Bar(x=pv.index, y=pv[('Quantity', 'pending')], name='Pending')
trace3 = go.Bar(x=pv.index, y=pv[('Quantity', 'presented')], name='Presented')
trace4 = go.Bar(x=pv.index, y=pv[('Quantity', 'won')], name='Won')

app = dash.Dash()
app.layout = html.Div(children=[
    html.H1(children='Sales Funnel Report'),
    html.Div(children='''National Sales Funnel Report.'''),
    dcc.Graph(
        id='example-graph',
        figure={
            'data': [trace1, trace2, trace3, trace4],
            'layout':
            go.Layout(title='Order Status by Customer', barmode='stack')
        })
])
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True
if __name__ == '__main__':
    app.run_server(port=3003)

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

Upvotes: 2

Views: 4710

Answers (2)

Samiie
Samiie

Reputation: 124

I happened to get this error for my code and upgrading the Dash package helped to fix the issue.

pip install dash --upgrade

Before it was v1.4.0, an upgrade made it v1.9.1

Upvotes: 1

ozgeneral
ozgeneral

Reputation: 6779

Not sure about this question specifically. But I ended up here because I got the same exact error because I renamed a div id, but I was still trying to get the old id as a State input in one of my callback functions.

Just leaving it here in case it helps someone.

Upvotes: 5

Related Questions