✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

AttributeError: partially initialized module 'dash_html_components' has no attribute 'Div' (most likely due to a circular import)

Does anyone have any idea why ‘dash_html_components’ is not working?

I am running Ubuntu LTS 20.04 with Python 3.8.2

I have used ‘pip3 install’ to install all latest required packages.

I am trying to run the following code:

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash() #creates flask application

colors = {'background':'#111111','text':'#7FDBFF'}

app.layout = html.Div(children = [
        html.H1('Hello Dash!',style={'textAlign':'center',
                                     'color':colors['text']}),
        #html.Div('Dash: Web Dashboards with Python'),
        dcc.Graph(id = 'example',
                  figure={'data':[
                          {'x':[1,2,3],'y':[4,2,1],'type':'bar','name':'SF'},
                          {'x':[1,2,3],'y':[2,4,5],'type':'bar','name':'NYC'}
                          ],
                          'layout':{
                                  'plot_bgcolor':colors['background'],
                                  'paper_bgcolor':colors['background'],
                                  'font':{'color':colors['text']},
                                  'title':'BAR PLOTS!'
                                  }})
        ], style = {'backgroundColor':colors['background']}
)

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