Dash in 20 minutes. Seriously

Can’t even get to the starting line. Seriously. What am I doing wrong?
app.layout assignment fails. it runs if I omit the square brackets, or change them to parentheses. maddening.

1 Like

:blush: Welcome! I don’t even thought about it, but if it works without parentheses, go that way!

Nope. Because the same wild guesses don’t work on the next tutorial example. And wild guesses aren’t really the way to go, in any case. :slight_smile:

What version of Dash are you using? It is a relatively recent addition to allow passing a list to the layout, it used to be that you can only pass a component.

Dash 2.14.2 (it’s in the screenshot). Python 3.12.3.
So it looks like the current release of dash is 2.18.2.
But it seems Anaconda wants 2.14.2, at least that’s the case in my environment.
Is that the difference? sigh
Gonna be a lot more than 20 minutes

instead of

app.layout = [html.Div(children="Hello World")]

this:

app.layout = html.Div(children="Hello World")

as indicated by @JuanG and @RenaudLN

There’s no reason anaconda would be stuck on dash 2.14, not sure what’s your setup though.

I have the same problem, but it works:

1 Like

@adamschroeder,

Maybe the example should check to see the version of dash that is running?

2 Likes

Yes, we should definitely do something about this. Let me talk this over with our technical writers and get back to you.

Thank you all for bringing this up.

1 Like

Guys my version of dash is 2.17.1 and I work with Jupyter Lab in a Conda environment…

indeed, @JuanG . The list wrapper of the app’s layout has been available since Dash 2.17.0 (fourth issue #2795).

Based on @jinnyzor 's suggestions, what if we add a comment to the initial code in the Dash-in-20 chapter that tells the user to check for the correct Dash version. Something like:

app.layout = [html.Div(children='Hello World')]  # make sure you have installed Dash 2.17.0 or a later version for this to work.
1 Like

Indeed, you are right. I upgraded, now I have version 2.18.2 and it works fine with . :tada:


Everything is good now.