I just set up Dash on a local (home) Ubuntu server and to test am using their own samples. Only thing I changed is the app.run
. When I execute the file I get the title error.
I looked around here on Stackoverflow and on the Plotly forums but the only info I can find is about code errors. I have checked that I copied and pasted the samples correctly, and they are.
Any pointers which can be provided are appreciated.
from dash import Dash, html
app = Dash()
app.layout = [html.Div(children='Hello World')]
if __name__ == '__main__':
#app.run(debug=True)
app.run_server(debug=True, host='0.0.0.0')
# also tried app.run(debug=True, host='0.0.0.0') here with same outcome
2
Answers
So! The issue was because I have Miniconda installed. The machine starts into conda, with the prompt showing the text (base).
which python3
also showed that the python being used was within the miniconda folder. Exiting conda (source deactivate
) and repeating the dash install procedure fixed the issue both when calling the dash python scipt from conda and not.Hope this helps.
The error you are encountering,
dash.exceptions.NoLayoutException
, is due to the assignment of thelayout
attribute in your Dash application. Thelayout
must be a Dash component or a function that returns a Dash component, not a list of components. In your code, you are assigningapp.layout
as a list with one element, which is incorrect.The corrected code line would be: