Forums

'dash_core_components' has no attribute 'Tabs'

Hi, I encountered the following error when I tried to update my webapp.

AttributeError: module 'dash_core_components' has no attribute 'Tabs'

My .py codes are

import dash
import dash_html_components as html
import dash_core_components as dcc

from dash.dependencies import Input, Output

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div([
    dcc.Tabs(id="tabs", value='tab-1', children=[
        dcc.Tab(label='Tab one', value='tab-1'),
        dcc.Tab(label='Tab two', value='tab-2'),
    ]),
    html.Div(id='tabs-content')
])

@app.callback(Output('tabs-content', 'children'),
              [Input('tabs', 'value')])
def render_content(tab):
    if tab == 'tab-1':
        return html.Div([
            html.H3('Tab content 1')
        ])
    elif tab == 'tab-2':
        return html.Div([
            html.H3('Tab content 2')
        ])

May I know why I am seeing this error? Is it because of the version of dash_core_components that I am using or is it because multiple tabs are not allowed for free account?

It is not the latter (ie. free/paying accounts would not cause this error).

It is possibly a version mismatch. Have you checked what version you are using, and what version you are expecting?

Hi Conrad, thank you for the response.

I deleted the dash_core_components library and re-installed it and the problem is solved.