Bokeh produces two charts when deployed!

Hello,

I am developing a simple app using bokeh (==2.2.1) and streamlit (==0.66.0).

When I compile the app (using streamlit) I get two identical bokeh charts. After refreshing the site( browser) the normal behavior, i.e. no duplicate chart is seen. It is quite random. This behavior was observed both in offline (localhost) and online (Heroku app) mode.
The Matplotlib plot works perfectly, which can be seen here: https://keff-app.herokuapp.com/

The .py file using bokeh is here: https://github.com/prabhasyadav/keff-app/blob/master/keff_fb.py

Not able to understand what exactly is the issue- likely something at the backend. I am not good enough to understand the backend process. You can easily call me a Noob. :blush:

Could someone suggest something? Bokeh is a much better chart option compared to Matplotlib, especially for web.

Prabhas

4 Likes

Hi @Prabhas_K_Yadav, welcome to the Streamlit community!

I’m not able to trigger this issue. Can you take a screenshot of this when it happens and post it here, or provide some steps to reproduce it?

Thanks for your response Randy,

First streamlit is awesome. Thanks a ton for such a great stuff. :blush:

The app, which is only my second attempt with the streamlit, has two Bokeh plots. One of the plots of the two is always duplicated. After refreshing the (web)page, the first one is not duplicated, but then the second one gets duplicated. This is random, also in the localhost server.

Pls. find a couple of screenshots here.

You may also see the screencapture (.webm file) from [Screen_Capture]
(https://drive.google.com/file/d/1Yj2oKf-Rs4fJrJpR2SMSQMBl6P17freF/view?usp=sharing)

You can find the code from my GitHub repo here https://github.com/prabhasyadav/keff-app.
The .py code with Bokeh the Bokeh plot is keff_bf

Thanks.

Prabhas

Hi, I have expierience the the same behavior.
It’s quite random.
For Reference:
Python 3.7.9
Name: streamlit
Version: 0.67.1
Name: bokeh
Version: 2.2.1

Hello All,

May be this could help.

In the app, I have used:
Python 3.8.3
Streamlit 0.67.1
bokeh 2.2.1
numpy 1.19.2
pandas 1.1.2

Bokeh is definitely a better library for the app.

Thanks

Prabhas

Hi Streamlit team,

Your app is amazing and I use it frequently.
Since I upgraded from version 0.64.x to 0.67.1 I’m experiencing the same issue.
I display Bokeh tables and they are doubled when I load them.
This issue is not happening all the time, but when it does, it is really frustrating.
Please address it as soon as possible.

Thank you

While I understand your frustration, I do want to highlight that we do take regressions seriously. However, when things are hard to trigger they are also hard to solve. If someone can figure out how to reliably cause this behavior, then it will likely get fixed in short order.

I have the same issue when using either st.write(bokeh_fig) or st.bokeh_chart(fig)., I’ve seen that when this happens, if you resize the web page it removes the duplicate one, maybe this helps you find the bug…
EDIT: I just realized that this is not happening in Stremlit version ā€˜0.62.1’.

Hi,

Just want to check if anyone working on this. This is really holding up the deployment of my app.

If someone can produce a code snippet that reliably triggers this issue, it will be easier for us to try and resolve it. As it is, I still can’t make this behavior on my local machine. That’s not saying it’s not happening to people (clearly, several people above have reported this), but without being able to trigger it ourselves, we don’t have anything to work from.

Best,
Randy

Hi,
this snippet triggers the described behavior for me:

I tested on two different machines:

  1. Windows 10 Pro:

Python Version: 3.8.3
Streamlit Version: 0.70.0
Bokeh Version: 2.2.3

  1. Debian Buster:

Python Version: 3.7.3
Streamlit Version: 0.70.0
Bokeh Version: 2.2.3

On both systems, the doubled chart does not appear on every load of the page.
I guess this occurs on every third load.

kind regards

1 Like

Thanks @BitBernd, that does it for me:

What’s interesting about this error is that it doesn’t require a re-run of app (for me), but rather, changing anything about the size of browser window makes the second chart’s div disappear. Makes me think there’s something confusing the React side of Streamlit.

Regardless of the why, I will pass your example on to our frontend team to see if they can figure out what might cause this.

1 Like

I am experiencing a similar issue as well. I would be glad if this problem has a solution.

Just chiming in to say that when I upgraded from streamlit 0.71.0 to 0.72.0 I now experience this bug. A solution would be much appreciated!

The issue seems to be resolved when I upgraded to 0.71.0.
So it seems there is a regression in 0.72.0.
If this really trouble you, I suggest you downgrade to 0.71.0 until the ST team can fix it again.

Thanks @erezrot, I suspected that as well. I did revert to 0.71.0 and indeed the issue went away, however 0.71.0 has other bugs that 0.72.0 fixed. Hard to choose which bugs I like more! :grimacing:

I see the same error here using version 0.73.0

I also commented on GitHub about this issue, but I have not received a response yet. I can also confirm this issue is still present in 0.73.0

Hi everyone -

This fix went into version 0.74, which was released this morning. Please let us know if you’re still seeing this issue after upgrading.

Best,
Randy