Search code examples
pythonplotly-dashdashboardmodulenotfounderror

ModuleNotFoundError: No module named 'dash.dash_table'


I am trying to run a simple code like this:

import dash
import dash_table
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')

app = dash.Dash(__name__)

app.layout = dash_table.DataTable(
    id='table',
    columns=[{"name": i, "id": i} for i in df.columns],
    data=df.to_dict('records'),
)

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

But get this error:

 Traceback (most recent call last):
  File "/Users/.../PycharmProjects/pythonProject1/main.py", line 2, in <module>
    import dash_table
  File "/Users/.../PycharmProjects/pythonProject1/venv/bin/py/lib/python3.8/site-packages/dash_table/__init__.py", line 1, in <module>
    from dash.dash_table import *  # noqa: F401, F403, E402
ModuleNotFoundError: No module named 'dash.dash_table'

Please help :(

P.S. I have already pip installed dash-table. Didn't help..


Solution

  • It looks like you have incompatible versions of dash and dash_table, with recent versions of Dash, when you install the dash package it also installs other packages including dash_table. Could you maybe uninstall dash_table and dash, reinstall dash, and see if it works?