Skip to content

[Bug]: StreamlitDuplicateElementId Error when Plotting with Plotly #382

@A-Akhil

Description

@A-Akhil

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When rendering a Plotly chart using st.plotly_chart(fig), the app encounters the following error:
StreamlitDuplicateElementId: This app has encountered an error...

Screenshot from the website

Add ScreenShots

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
exec(code, module.dict)
File "/mount/src/stackoverflow-analysis/streamlit/home.py", line 139, in
main.main_analysis_2(df2018)
File "/mount/src/stackoverflow-analysis/streamlit/main_analysis.py", line 265, in main_analysis_2
ff.plot_bar_plotly(ds, "Country")
File "/mount/src/stackoverflow-analysis/streamlit/functions.py", line 49, in plot_bar_plotly
return st.plotly_chart(fig)
^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/metrics_util.py", line 410, in wrapped_func
result = non_optional_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/elements/plotly_chart.py", line 506, in plotly_chart
plotly_chart_proto.id = compute_and_register_element_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/elements/lib/utils.py", line 226, in compute_and_register_element_id
_register_element_id(ctx, element_type, element_id)
File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/elements/lib/utils.py", line 132, in _register_element_id
raise StreamlitDuplicateElementId(element_type)

What browsers are you seeing the problem on?

Firefox, Chrome

Record

  • I agree to follow this project's Code of Conduct
  • I'm a GSSOC contributor
  • I want to work on this issue
  • I'm willing to provide further clarification or assistance if needed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions