Datatable 3.2.0 failing with: dash.dash.exceptions.NoLayoutException: Layout must be a dash component or a function that returns a dash component.
See original GitHub issueAn upgrade broke datatables for my environment, and I haven’t been able to undo the break even after rolling back the update, completely uninstalling python and starting from scratch, etc. Any app with a datatable is failing with the following error:
Dash Version 0.35.2
Dash DataTable Version 3.2.0
Dash Core Components Version 0.43.0
Dash HTML Components Version 0.13.5
Pandas Version 0.24.0
Numpy Version 1.16.1
Plotly Version 3.5.0
cx_Oracle Version 12.2.0.1.0
Traceback
(most recent call last):
File "C:\Users\david\.spyder-py3\dataagg_Test_001.py", line 73, in <module>
data=dataaggrun.to_dict("rows"),
File "C:\Users\david\AppData\Roaming\Python\Python37\site-packages\dash\dash\dash.py", line 279, in layout
''
dash.dash.exceptions.NoLayoutException: Layout must be a dash component or a function that returns a dash component.
It appears to be looking for a layout component, but none is require for a datatable. I downgraded back to my original versions, but the issue persists. My simplified code is below:
import dash
import dash_table
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
import plotly
import cx_Oracle
#... some stuff here
#Retrieve DATAAGGRUN records
dataaggrunhist where processname = \'DATA AGGREGATION\' and status = \'COMPLETE\') order by dataaggrunid desc'
dataaggrun_query = 'select * from dataaggrun where dataaggrunid =4 order by dataaggrunid desc'
dataaggrun = pd.read_sql(dataaggrun_query, con= db)
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
html.Div(id='dataaggrun-table-container'),
dash_table.DataTable(
id='dataaggrun-table',
columns=[
{"name": i, "id": i} for i in dataaggrun.columns
],
data=dataaggrun.to_dict("rows"),
),
])
if __name__ == '__main__':
app.run_server(debug=True)
The code from the dash.py file being referenced is below:
@layout.setter
def layout(self, value):
if (not isinstance(value, Component) and
not isinstance(value, collections.Callable)):
raise exceptions.NoLayoutException(
''
'Layout must be a dash component '
'or a function that returns '
'a dash component.')
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
NoLayoutException: Layout must be a dash component or a ...
NoLayoutException : Layout must be a dash component or a function that returns a dash component. I am not able to figure out...
Read more >Layout must be a dash component? - python - Stack Overflow
The problem is that your layout is a tuple, because it ends with a comma. If we take out the children, what you...
Read more >Dash User Guide and Documentation
Dash provides an interactive DataTable as part of the data-table project. ... walk you through a fundamental aspect of Dash apps, the app...
Read more >DataTables Extensions
The FixedColumns extension does not work well with row selection: when you select rows in the fixed columns, the rows in other columns...
Read more >How to fix "dash.exceptions.NoLayoutException" Error-pandas
NoLayoutException dash.exceptions.NoLayoutException: The layout was `None` at the time that `run_server` was called. Make sure to set the `layout` attribute of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@davidghill I happen to be subscribed to this repo so I skimmed the email I got for this issue. You definitely shouldn’t need to install the SSL package, and as @Marc-Andre-Rivet pointed out what you’re trying to install is a Python2 package in a Python3 environment. Moreover, it is an old package. This is in the
setup.py
:You may want to look at https://stackoverflow.com/questions/41328451/ssl-module-in-python-is-not-available-when-installing-package-with-pip3.
Feels like the script ran against python2 and then against python3 (enforcing parentheses)?
As this seems to be more of an environmental issue, I think you’ll have better chances of finding a resolution to this issue by sharing it on the community forum (https://community.plot.ly/).