✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

AttributeError: module 'dash' has no attribute 'Dash'

Hi,
Im a beginner, till yesterday i was running a code, wich was running fine, but today when i ran the same code, it started giving me this error below:

“Traceback (most recent call last):
File “rough.py”, line 1, in
import dash as dash
File "C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\dash_init
.py”, line 1, in
from .dash import Dash, no_update # noqa: F401
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\dash\dash.py”, line 18, in
from future.moves.urllib.parse import urlparse
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\future\moves_init_.py”, line 8, in
import_top_level_modules()
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\future\standard_library_init_.py”, line 810, in import_top_level_modules
with exclude_local_folder_imports(*TOP_LEVEL_MODULES):
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\future\standard_library_init_.py”, line 781, in enter
module = import(m, level=0)
File “C:\Users\BG\Desktop\Cogencis Office\Cogencis Project\financialreport\test.py”, line 3, in
from jupyter_dash import JupyterDash
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_dash_init_.py”, line 2, in
from .jupyter_app import JupyterDash
File “C:\Users\BG\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_dash\jupyter_app.py”, line 26, in
class JupyterDash(dash.Dash):
AttributeError: module ‘dash’ has no attribute ‘Dash’

I searched over internet to interpret this but i couldn’t… Tried with the code as basic as

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()
app.layout = html.Div([
dcc.Graph(figure=fig)
])

app.run_server(debug=True)

Still even this is not working. Can anyone help ?

1 Like

do you happen to have a file named dash.py? The JupyterDash code might be importing that file instead of importing the dash module.

1 Like

No, i don’t have any file with that name, i just now activated my conda base and opened a new jupyter notebook to run my .py file.

IT WORKED !! , still couldn’t understand exactly what had happened.

Interesting. I just ran into the same problem with a file called test.py in that directory.

1 Like

Can confirm having a test.py file in the cwd will cause this error.

2 Likes

Same trouble using a test.py file. Just change name and it works :thinking:

test.py is the problem, change it. it will be work right away.

If there is a test.py file in your directory, this error will happen if you try to run this file or any other file in that directory.