SimonBlanke/Hyperactive

RecursionError: maximum recursion depth exceeded in comparison

SimonBlanke opened this issue · 2 comments

When running the Progress Board for a long time (~1 hour) the following error occurs. I have not been able to reproduce this error in a shorter time. This error seems to originate from plotly but I suspect that the integration of the plotly-figure into the streamlit dashboard (which reruns ~1/second) triggers this.

File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/streamlit/script_runner.py", line 350, in _run_script
    exec(code, module.__dict__)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/hyperactive/dashboards/progress_board/run_streamlit.py", line 78, in <module>
    main()
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/hyperactive/dashboards/progress_board/run_streamlit.py", line 40, in main
    plotly_fig = backend.plotly(progress_data, progress_id)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/hyperactive/dashboards/progress_board/streamlit_backend.py", line 119, in plotly
    fig = px.parallel_coordinates(
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/express/_chart_types.py", line 1306, in parallel_coordinates
    return make_figure(args=locals(), constructor=go.Parcoords)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/express/_core.py", line 2121, in make_figure
    fig.update_layout(template=args["template"], overwrite=True)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 1403, in update_layout
    self.layout.update(dict1, overwrite=overwrite, **kwargs)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5082, in update
    BaseFigure._perform_update(self, kwargs, overwrite=overwrite)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 3891, in _perform_update
    plotly_obj[key] = val
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5821, in __setitem__
    super(BaseLayoutHierarchyType, self).__setitem__(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4811, in __setitem__
    self._set_compound_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5222, in _set_compound_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2747, in validate_coerce
    return super(BaseTemplateValidator, self).validate_coerce(
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2458, in validate_coerce
    v = self.data_class(v)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/graph_objs/layout/_template.py", line 319, in __init__
    self["data"] = _v
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4811, in __setitem__
    self._set_compound_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5222, in _set_compound_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2454, in validate_coerce
    v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/graph_objs/layout/template/_data.py", line 1533, in __init__
    self["barpolar"] = _v
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4815, in __setitem__
    self._set_array_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5296, in _set_array_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2546, in validate_coerce
    res.append(self.data_class(v_el, skip_invalid=skip_invalid))
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/graph_objs/_barpolar.py", line 1840, in __init__
    self["marker"] = _v
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4811, in __setitem__
    self._set_compound_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5222, in _set_compound_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2454, in validate_coerce
    v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/graph_objs/barpolar/_marker.py", line 1123, in __init__
    self["line"] = _v
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4811, in __setitem__
    self._set_compound_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5222, in _set_compound_prop
    val = validator.validate_coerce(val, skip_invalid=self._skip_invalid)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 2454, in validate_coerce
    v = self.data_class(v, skip_invalid=skip_invalid, _validate=_validate)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/graph_objs/barpolar/marker/_line.py", line 628, in __init__
    self["color"] = _v
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 4819, in __setitem__
    self._set_prop(prop, value)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/plotly/basedatatypes.py", line 5158, in _set_prop
    val = validator.validate_coerce(val)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 1367, in validate_coerce
    validated_v = self.vc_scalar(v)
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 1397, in vc_scalar
    return ColorValidator.perform_validate_coerce(
File "/home/simon/anaconda3/envs/dev/lib/python3.8/site-packages/_plotly_utils/basevalidators.py", line 1420, in perform_validate_coerce
    if isinstance(v, numbers.Number) and allow_number:
File "/home/simon/anaconda3/envs/dev/lib/python3.8/abc.py", line 98, in __instancecheck__
    return _abc_instancecheck(cls, instance)

From further experiments I am now sure, that this is a problem with the experimental_rerun in streamlit. If there are no plots contained in the progress-board the recursion error will still occur. Increasing the recursion limit just increases the time before the error starts + the memory usage will increase further over time.

After trying several different approaches, I came to the conclusion to ditch Streamlit for this live update dashboard because I couldn't implement a satisfactory solution to this problem.
I will reimplement the entire dashboard in panel for Hyperactive v4. Panel seems to be better equipped for live-updates in plots and tables.