Alex Yahiaoui Martinez
Alex Yahiaoui Martinez

Reputation: 994

Plotly/dash - Module 'dash_html_components' has no 'Div' member

I would like run this code from plotly.
Before, I installed these modules:

pip install dash==0.21.1  # The core dash backend
pip install dash-renderer==0.13.0  # The dash front-end
pip install dash-html-components==0.11.0  # HTML components
pip install dash-core-components==0.23.0  # Supercharged components
pip install plotly --upgrade  # Latest Plotly graphing library

My code is:

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

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

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    dcc.Graph(
        id='example-graph',
        figure={
            'data': [
                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'}, 
                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
            ],
            'layout': {
                'title': 'Dash Data Visualization'
            }
        }
    )
])

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

However it doesn't work et I don't understand why ! Can you help me please ! Thanks

Upvotes: 2

Views: 6067

Answers (2)

Manoj Kesavulu
Manoj Kesavulu

Reputation: 41

I know this is an old question but I ran into this error recently and the previous answer did not help.

Upon further exploration, the reason for this error is the packages dash_html_components is deprecated.

Solution: replace import dash_core_components as dcc with from dash import dcc

Also, other similar package that is deprecated now is dash_html_components

Upvotes: 3

Nils
Nils

Reputation: 2695

With python3 the code can be executed.

My package versions are:

dash==0.21.1
dash-core-components==0.23.0
dash-html-components==0.11.0
dash-renderer==0.13.0
plotly==2.7.0

Result: Dash Webpage

Upvotes: 1

Related Questions