AttributeError: module 'dash.dash' has no attribute 'dependencies'

Multi tool use
AttributeError: module 'dash.dash' has no attribute 'dependencies'
Below is my error,
Traceback (most recent call last): File "app.py", line 54, in
dash.dependencies.Output('react-graph','figure'), AttributeError: module 'dash.dash' has no attribute 'dependencies'
Below are my imports,
from dash import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import psycopg2
import os
import flask
Below is my callback function
@app.callback( dash.dependencies.Output('react-graph','figure'), [dash.dependencies.Input('reg_col','value')] )
I do not have any file named dash.py in my current directory. I have also tried to change to the import dash from dash to just import dash. The former gives me the below error.
Dash was not successfully imported. Make sure you don't have a file named 'dash.py' in your current directory.
below are the contents of my sys.path,
'P:\CC\Commercial\Nilay\ProjectX\Interactivity_test\Interactivity_test',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\python36.zip',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\DLLs',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib\site-packages',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib\site-packages\Babel-2.5.0-py3.6.egg',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib\site-packages\win32',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib\site-packages\win32\lib',
'C:\Users\nilay.doshi\AppData\Local\Continuum\anaconda3\lib\site-packages\Pythonwin']
@app.callback(Output('react-graph','figure'), [Input('reg_col','value')]
I pulled that off through the dash documentation dash.plot.ly/getting-started-part-2 regardless still gives the errors but it seems to execute with the from dash import dash. Still quite confusing why it wont work with the dash.dependencies included in the callback.
– moksha
Jul 2 at 9:52
What is the purpose of
from dash import dash
? Why do you think you need to do this?– ekhumoro
Jul 2 at 9:55
from dash import dash
Im really not sure I picked it up from some other code. But, if I just keep it as import dash and still carry out your correction from the first comment, I still get the error 'Dash was not successfully imported. Make sure you don't have a file named 'dash.py' in your current directory.'
– moksha
Jul 2 at 10:01
There's a typo in @ekhumoro 's comment. To find out the file from which 'dash' was imported, do
import dash ; print(dash.__file__)
(without quotes).– Leo K
Jul 2 at 12:29
import dash ; print(dash.__file__)
1 Answer
1
Probing further, on checking the contents of the
__init__.py
file showed some incomplete lines in it probably missed out due to a bad installation.
I have altered the file with the contents from (https://github.com/plotly/dash/blob/master/dash/init.py) and the error is no more.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Why not just do:
@app.callback(Output('react-graph','figure'), [Input('reg_col','value')]
?– ekhumoro
Jul 2 at 9:50