user16561758
user16561758

Reputation: 49

ModuleNotFoundError: No module named 'dash.html'

import dash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objects as go
import plotly.express as px

while running this code in Jupyter Notebook I am getting an error.what should i do.

ModuleNotFoundError                       
Traceback (most recent call last)/tmp/ipykernel_7237/1432543730.py in <module>
      1 import dash
----> 2 import dash_html_components as html
      3 import dash_core_components as dcc
      4 import plotly.graph_objects as go
      5 import plotly.express as px

~/.local/lib/python3.8/site-packages/dash_html_components/__init__.py in <module>
----> 1 from dash.html import *  # noqa: F401, F403, E402
      2 from dash.html import __version__  # noqa: F401, F403, E402
      3 import warnings
      4 
      5 warnings.warn(ModuleNotFoundError: No module named 'dash.html')

Upvotes: 2

Views: 5670

Answers (3)

Ashish Singh
Ashish Singh

Reputation: 11

I had named my python file as 'dash.py' and was getting this error. I changed the file name and the issue got resolved.

Upvotes: 1

Masoud
Masoud

Reputation: 9

Try

!pip install --upgrade plotly
!pip install jupyter-dash

Upvotes: 0

Lukas
Lukas

Reputation: 2302

Try to replace import dash_html_components as html with from dash import html There is a note in init.py of current version, that dash_html_components package is deprecated (link). The other question is if your installation is correct (missing package resp. dependencies), because this error seems to come from source, not from your code. You can try to reinstall dash with something like pip install --upgrade --force-reinstall dash

Upvotes: 0

Related Questions