# Dash object has no attribute run

**URL:** https://community.plotly.com/t/dash-object-has-no-attribute-run/80523
**Category:** Dash Python
**Tags:** dash-online-course
**Created:** [November 29, 2023, 11:44am UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523 "2023-11-29T11:44:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![viviensiu](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@viviensiu](https://community.plotly.com/u/viviensiu)
#### Post date: [November 29, 2023, 11:44am UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/1 "2023-11-29T11:44:55Z")

</div>

Hi, I am new to Dash and was wondering if anyone who managed to complete the tutorial could give me some pointers?

I’m currently working on this tutorial [https://dash.plotly.com/tutorial](https://dash.plotly.com/tutorial) and noticed some issues with mine.

1. I have to change my code from “app.run” to “app.run\_server” since it would throw error “Dash object has no attribute run”.
2. The table wouldn’t load at all for this line of code: `dash_table.DataTable(data=df.to_dict('records'), page_size=6)`. This was somewhat odd since the graph was able to load the csv data without issues.
3. When I try out the radio button tutorial, I encountered these error messages per screenshot:  
 ![Screenshot 2023-11-29 at 11.35.32 AM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/6/d/6d379445d28a9f4280019ac29efa802bb71cbaf9.jpeg)

If it helps, this is my code:

```auto
# Import packages
from dash import Dash, html, dash_table, dcc, callback, Output, Input
import pandas as pd
import plotly.express as px

# Incorporate data
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')

# Dash constructor, responsible for initializing app
app = Dash( __name__ )

app.layout = html.Div([
    html.Div(children='My First App with Data, Graph, and Controls'),
    html.Hr(),
    dcc.RadioItems(options=['pop', 'lifeExp', 'gdpPercap'], value='lifeExp', id='controls-and-radio-item'),
    dash_table.DataTable(data=df.to_dict('records'), page_size=6),
    dcc.Graph(figure={}, id='controls-and-graph')
])

# Add controls to build the interaction
@callback(
    Output(component_id='controls-and-graph', component_property='figure'),
    Input(component_id='controls-and-radio-item', component_property='value')
)
def update_graph(col_chosen):
    fig = px.histogram(df, x='continent', y=col_chosen, histfunc='avg')
    return fig

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

```

---

<div class="post-metadata">

### Author: ![AnnMarieW](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AnnMarieW](https://community.plotly.com/u/AnnMarieW)
#### Post date: [November 29, 2023, 2:06pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/2 "2023-11-29T14:06:37Z")

</div>

Hi @viviensiu and welcome to Dash 🙂

It looks like you are running an old version of Dash. Try upgrading the to the most recent (currently 2.14.2). To double check the version in the app try adding:

```auto

import dash
print("dash version=", dash. __version__ )

```

---

<div class="post-metadata">

### Author: ![viviensiu](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@viviensiu](https://community.plotly.com/u/viviensiu)
#### Post date: [November 29, 2023, 2:26pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/3 "2023-11-29T14:26:40Z")

</div>

Hi @AnnMarieW I installed Dash thru conda: `conda install -c conda-forge dash`. The version was 2.0.0

Somehow running `conda update dash` downgraded the version to 1.19.0

Could you please direct me on how to upgrade it to the latest version? Thank you.

---

<div class="post-metadata">

### Author: ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)
#### Post date: [November 29, 2023, 4:55pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/4 "2023-11-29T16:55:19Z")

</div>

hi @viviensiu  
That’s a good question. I don’t have conda installed on my computer, but you should be able to type:

```auto
conda install -c conda-forge dash=2.14.2 

```

Or earlier versions. Use this link to see the latest version of [Dash on Anaconda](https://anaconda.org/conda-forge/dash),.

---

<div class="post-metadata">

### Author: ![viviensiu](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@viviensiu](https://community.plotly.com/u/viviensiu)
#### Post date: [November 29, 2023, 7:49pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/5 "2023-11-29T19:49:42Z")

</div>

Hi @adamschroeder , thanks for the tip. After a few updates on Dash, Python and Conda on my (rather outdated) conda environment it finally worked!  
Funnily though, I do not see the http link in my Spyder 5.4.3 console, and there were similar issues reported like this here: [https://stackoverflow.com/questions/76911502/http-link-on-plotly-dash-is-not-showing-in-spyder](https://stackoverflow.com/questions/76911502/http-link-on-plotly-dash-is-not-showing-in-spyder)

I’d have to memorize the default localhost link as it is still able to load there.

---

<div class="post-metadata">

### Author: ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)
#### Post date: [November 29, 2023, 7:59pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/6 "2023-11-29T19:59:31Z")

</div>

can you share your code please?

Do you see the http link anywhere else inside Spyder?

---

<div class="post-metadata">

### Author: ![viviensiu](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@viviensiu](https://community.plotly.com/u/viviensiu)
#### Post date: [November 29, 2023, 8:27pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/7 "2023-11-29T20:27:58Z")

</div>

Here is the code as requested:

```auto
from dash import Dash, html, dash_table, dcc, callback, Output, Input
import pandas as pd
import plotly.express as px

# Incorporate data
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder2007.csv')

# Initialize the app - incorporate css
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = Dash( __name__ , external_stylesheets=external_stylesheets)

app.layout = html.Div([
    html.Div(className='row', children='My First App with Data, Graph, and Controls',
             style={'textAlign': 'center', 'color': 'blue', 'fontSize': 30}),

    html.Div(className='row', children=[
        dcc.RadioItems(options=['pop', 'lifeExp', 'gdpPercap'],
                       value='lifeExp',
                       inline=True,
                       id='my-radio-buttons-final')
    ]),

    html.Div(className='row', children=[
        html.Div(className='six columns', children=[
            dash_table.DataTable(data=df.to_dict('records'), page_size=11, style_table={'overflowX': 'auto'})
        ]),
        html.Div(className='six columns', children=[
            dcc.Graph(figure={}, id='histo-chart-final')
        ])
    ])
])

# Add controls to build the interaction
@callback(
    Output(component_id='histo-chart-final', component_property='figure'),
    Input(component_id='my-radio-buttons-final', component_property='value')
)
def update_graph(col_chosen):
    fig = px.histogram(df, x='continent', y=col_chosen, histfunc='avg')
    return fig

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

```

After running the code in Spyder 5.4.3, I can only see the following in console:

 ![Screenshot 2023-11-29 at 8.26.10 PM](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/8/2/821315c1237cd6cb54aa511868fccaa20ed18afe.png)

---

<div class="post-metadata">

### Author: ![adamschroeder](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/adamschroeder/32/17280_2.png) [@adamschroeder](https://community.plotly.com/u/adamschroeder)
#### Post date: [November 30, 2023, 3:58pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/8 "2023-11-30T15:58:25Z")

</div>

I have read in a couple other stackoverflow posts that this happens in Spyder. Not sure what the Spyder solution is.

But one workaround, which I think you mentioned, is to save [http://127.0.0.1:8050/](http://127.0.0.1:8050/) as a browser bookmark for easier access. Or, although it’s not ideal, you can try to switch to PyCharm or VS Code. I haven’t heard this happen with those platforms.

---

<div class="post-metadata">

### Author: ![viviensiu](https://avatars.discourse-cdn.com/v4/letter/v/a587f6/32.png) [@viviensiu](https://community.plotly.com/u/viviensiu)
#### Post date: [November 30, 2023, 3:59pm UTC](https://community.plotly.com/t/dash-object-has-no-attribute-run/80523/9 "2023-11-30T15:59:57Z")

</div>

Thanks for taking a look @adamschroeder , will keep this in mind!
