Error loading dependencies when using "state" submit button in callback

Hello ! I trying to use the “submit button” in my callback using the state component. But as soon as I try to launch the python application, my browser tell me that they’re some “Error loading dependencies”. I think that the error is caused because of incompatibility with some elements of Dash like “State” from “dash.dependencies”.

Here are the few lines of code involved :

  • In the layout :

    html.Div([
    html.Div([
    html.Div([
    html.Button(id=‘submit-button’, n_clicks=0, children=‘Submit’),
    ],
    ),
    html.Div(
    id=‘Flash-Datatable’,
    ),
    ],
    ),
    ]),

  • the callback (the states are taken from anther callback just before this one) :

    #@app.callback(Output(‘Flash-Datatable’,‘children’),[Input(‘read_address’,‘value’),Input(‘read_words’,‘value’)]) #Callback 3.5 - Affichage du tableau demandé (HTML ou Heatmap)
    @app.callback(Output(‘Flash-Datatable’,‘children’),
    [Input(‘submit-button’,‘n_clicks’)],
    [State(‘read_address’,‘value’), State(‘read_words’,‘value’)]
    ) #Erreur : “Loading dependencies”
    def update_rows(n_clicks, rows ,columns):
    print(‘nclicks=’,n_clicks)
    print(“columns=”,columns," at ",rows)
    columns = columns + 1
    global mode
    if mode == 1 or mode == 2 :
    table = (
    html.Table(
    # Header
    [html.Tr([html.Th(col) for col in range(min(len(df), columns))])] +

                  # Body
                  [html.Tr([
                      html.Td(df.iloc[i][col]) for col in range(min(len(df), columns))
                  ]) for i in range(min(len(df), rows))]
              )
          )
          
          return table
    

    . . . . . . . . . . .Affichage en mode graphique

      elif mode == 3 : #Affichage en mode graphique 
          print("rows===",rows)
          print (df[df['add']==rows].index)
          print (df[df['add']==rows].index.values)
          startaddress = df[df['add']==rows].index.values[0]
          print("start ", startaddress)
          bits=34*columns
          rows2print = int(bits / 1088)+1
          return dcc.Graph(
              figure={
                  'data': [
                      go.Heatmap(
                      showscale=False,#Masquer l'échelle
                      x=df.columns[1:],
                      y=range(startaddress,startaddress+rows2print+1),
                      z=df.iloc[range(startaddress,startaddress+rows2print+1)][df.columns[1:]].values.tolist(), #Fonctionne pour les adresse (de 1 à 1088 bits)
                      colorscale=[[0,'black'],[1, 'rgb(240,240,240)']]
                      )
                  ] ,
                  'layout': go.Layout()
              }
          )
    

When i just put the line
[State('read_address','value'), State('read_words','value')]
in commentary, I notice that they’re no problem (they’re just the submit button which is not functional.

I’m with :

  • Dash v0.43.0
  • dcc v0.48.0
  • Python 3.7.3
  • Python 2.7.9
    and my app is launch with Python 2.7.9 only because they’re is a compatibility problem with Dash when i’m trying to launch with Python 3 instead.

I’m available if you need more information

I can’t figure out your code from what you’ve posted, do you have a small minimal example that you could post that’s well formatted?

But a couple of things regardless, “Error loading dependencies” is often generated from circular references between your Input and Outputs, try drawing your Input/Output Callbacks as a graph and see if it’s circular.

There’s no compatibility problem between Dash and Python 3, something else must be wrong with your environment.