Circular callbacks - Error

Hi everyone

I have just tried the new feature circular callbacks. It doesn’t seem to work for me.

  • The page keeps refreshing
  • I’ve got this error message : “Circular Dependencies - Error: Dependency Cycle Found: input.value → input.value”

What am I doing wrong?

I ran the code of the documentation as is:

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html

external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.layout = html.Div(
    [
        dcc.Slider(
            id="slider-circular", min=0, max=20, 
            marks={i: str(i) for i in range(21)}, 
            value=3
        ),
        dcc.Input(
            id="input-circular", type="number", min=0, max=20, value=3
        ),
    ]
)
@app.callback(
    Output("input-circular", "value"),
    Output("slider-circular", "value"),
    Input("input-circular", "value"),
    Input("slider-circular", "value"),
)
def callback(input_value, slider_value):
    ctx = dash.callback_context
    trigger_id = ctx.triggered[0]["prop_id"].split(".")[0]
    value = input_value if trigger_id == "input-circular" else slider_value
    return value, value

if __name__ == '__main__':
    app.run_server(debug=True)

This is my environment (python 3.9):

# packages in environment at C:\SafApp\umamba\envs\dash_circular:
#
# Name                    Version                   Build  Channel
brotlipy                  0.7.0           py39h2bbff1b_1003  
ca-certificates           2021.1.19            haa95532_0  
certifi                   2020.12.5        py39haa95532_0  
cffi                      1.14.5           py39hcd4344a_0  
click                     7.1.2              pyhd3eb1b0_0  
dash                      1.19.0             pyhd3eb1b0_0  
dash-core-components      1.3.1                      py_0  
dash-html-components      1.0.1                      py_0  
dash-renderer             1.1.2                      py_0  
dash-table                4.4.1                      py_0  
flask                     1.1.2              pyhd3eb1b0_0  
flask-compress            1.5.0                      py_0  
future                    0.18.2           py39haa95532_1  
itsdangerous              1.1.0              pyhd3eb1b0_0  
jinja2                    2.11.3             pyhd3eb1b0_0  
markupsafe                1.1.1            py39h2bbff1b_0  
openssl                   1.1.1j               h2bbff1b_0  
pip                       21.0.1           py39haa95532_0  
plotly                    4.14.3             pyhd3eb1b0_0  
pycparser                 2.20                       py_2  
python                    3.9.1                h6244533_2  
pyyaml                    5.4.1            py39h2bbff1b_1  
retrying                  1.3.3                      py_2  
setuptools                52.0.0           py39haa95532_0  
six                       1.15.0           py39haa95532_0  
sqlite                    3.33.0               h2a8f88b_0  
tzdata                    2020f                h52ac0ba_0  
vc                        14.2                 h21ff451_1  
vs2015_runtime            14.27.29016          h5e58377_2  
werkzeug                  1.0.1              pyhd3eb1b0_0  
wheel                     0.36.2             pyhd3eb1b0_0  
wincertstore              0.2              py39h2bbff1b_0  
yaml                      0.2.5                he774522_0  
zlib                      1.2.11               h62dcd97_4  

Hi @haris

I copy and paste your code and work perfect (no error).

For some reason your enviroment is running a different Dash version that what is showing (I Think) :thinking:

strange #1: I execute the script well from a new conda environment.

strange #2:

  • the app is kind of working
  • If I move the slider, the value in the input is modified.
  • but the page keeps refreshing & i’ve got this error message

for information: if I put a print(dash.__version__), I get the right version 1.19.0

@haris

See dash renderer, last version 1.9.0
You have 1.1.2.

1 Like

well done! it was the dash-renderer version that caused the problem

I can’t install the right version of dash-renderer with conda

problem solved with pip