Hello Streamlit Community!
I am hosting a streamlit app on Heroku, and have noticed an issue when more than one user is attempting to render Matplotlib figures (specifically seaborn cluster map). Two things tend to happen - either the app immediately crashes and all users are disconnected until the app refreshes to the original title page, or the error below is shown to one user while the other is able to continue rendering the image. Any advice/solutions to this issue? Has anyone else experienced this?
Thanks!
Hi @shivpalit, welcome to the Streamlit community!
matplotlib has an issue with multiple threads, which we provide a solution for in our docs:
https://docs.streamlit.io/en/stable/deploy_streamlit_app.html?highlight=matplotlib#limitations-and-known-issues
As you’ve seen, once multiple users start dealing with an app (as happens with deployment), you often see errors as you are describing.
Best,
Randy
1 Like
Thanks for your response @randyzwitch! I should’ve taken a deeper look into the docs …
If I am rendering multiple images on the page, would you recommend assigning a lock variable for each? Or can I use the same lock variable for all figure outputs.
Thanks you!
Shiv
I believe you need a lock for each figure.