Search code examples
pythonplotly-dashimporterrordashboardplotly-python

ImportError: cannot import name 'dcc' from partially initialized module 'dash' - python


I'm very new to python/dash/plotly and I keep getting the same error:

ImportError: cannot import name 'dcc' from partially initialized module 'dash' (most likely due to a circular import)

Does anyone know how to fix this? I've imported the following:

from dash import dcc
from dash import html
from dash.dependencies import Input, Output
import plotly.io as pio

Solution

  • "most likely due to a circular import": this is probably due to your file being named as a dash or as a module name.

    But I got the error message

    ImportError: cannot import name 'dcc' from 'dash'

    For me reinstalling dash fixed the issue.

    1. pip3 uninstall dash
    2. pip3 install dash