Unable to start Dash

Hello All,

I am new to Dash and I cannot even run the simplest example.
After I run my app.py, there is nothing happens(no error, nothing). Am I supposed to see “Restarting with stat”? When I type in my browser, it cannot be opened. I tried both python IDLE and vscode, they gave me the same results.

Anyone can help me?
Thank you in advance.

I’ve some people having problems running Dash from IDLE and other tools that are dynamically inserting scripts in to a REPL to run the code. I think it relates to how Flask (the underlying framework library) works.

Try just running directly from your command line (open cmd or powershell):

cd C:\Users\Zach
python app1.py

Thank you for the reply.
i tried your way but it gave me the same result.


At the bottom of your code you have if __name__ = '_main_'. This should be if __name__ = '__main__' (ie with two underscored in either side of ‘main’).

That is most likely why your app isn’t running.

1 Like

I cannot believe I am so stupid!!! :rofl::rofl::rofl:
You saved my day and thank you so much!

1 Like

I am having the same issue in the initial post despite my code being the same as the tutorials. My app doesn’t run on the terminal despite showing no errors. Below is my code.

import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

# 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")

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

        Dash: A web application framework for Python.


if __name__ == '__main__':