NameError: name 'Dash' is not defined. Did you mean: 'hash'?

I am getting the following error:
NameError: name 'Dash' is not defined. Did you mean: 'hash'?

Basically just installed dash and am trying to run the most basic example from the Dash website.
Any help or direction would be appreciated, as I have spent quite a bit of time scouring the interwebs for this problem, and coming with no solutions at present.

Python 3.10
Dash 2.3.0

# Run this app with `python` and
# visit in your web browser.

from dash import Dash, html, dcc
import as px
import pandas as pd

app = Dash(__name__)

# assume you have a "long-form" data frame
# see for more options
df = pd.DataFrame({
    "Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
    "Amount": [4, 1, 2, 2, 4, 5],
    "City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]

fig =, x="Fruit", y="Amount", color="City", barmode="group")

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

        Dash: A web application framework for your data.


if __name__ == '__main__':

Hi @0xjdavis and welcome to the community!

If have installed dash within an environment, can you check if you are running the python file from the same environment?

Yes. I have checked everything I can think to check.

I have uninstalled and installed dash in multiple versions, tried using various forms of import (i.e. - import vs. from), renamed file names, etc… and always get this same error.

FYI - I am not using jupyter or conda…

I also have no problem running plotly files without dash

Nothing with your code sample. I’m running the same version of Dash you indicated.

How are you invoking the code?

Thanks for taking the time to review this question folks… it feels like from the follow up questions, this has to be a very odd one/off issue. By example, that this must be what I would generally refer to as ‘user error’, which may be valid. I assure you, however, I don’t have an issue running other code including code which requires NumPy or Pandas.

“How are you invoking the code?”

like any other python script, and as the comment in the provided Demo code above indicates…


Any known conflicts with other modules by chance?

what python IDE are you using? PyCharm?

No. But an IDE would have nothing to do with it. This is just copy/paste sample code from the Dash site and running it via the command line. It wouldn’t matter if I was using PyCharm, Visual Studio, or Notepad for that matter.

I just tried it using the command line and it worked. I agree with the content above. I think it’s having difficulties reading correctly the libraries that you installed in your operating system.

Try doing:

import dash

at the top of your file.

Also make sure that you don’t have a file named in your folder - otherwise python will import that file instead of the module.

Uh… it can’t import “dash” that is the problem… i.e. ‘Dash’ is not defined. Therefore, it is not importing.
There are no other files in the folder… it is just

Fuck me running… so for the umpteenth time i uninstalled Dash and reinstalled… it appears to be a new version which is (Dash-2.3.1) :tada:

It now works.

Thanks for the stabs in the dark folks.