Version 1.15. returns error

Just tried to upgrade to 1.15 and got this error.

Hi @Fabio ,

hm that’s such a weird error. We have been doing some changes with the altair and plotly charts so I’m wondering if you have some code so that I can reproduce it. I tried reproducing it by installing streamlit 1.15.0 and then running

import pandas as pd
import numpy as np
import altair as alt

chart_data = pd.DataFrame(
    np.random.randn(20, 3),
    columns=['a', 'b', 'c'])

c = alt.Chart(chart_data).mark_circle().encode(
    x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])

st.altair_chart(c, use_container_width=True)

but I couldn’t reproduce it!

Hi i will try with your snippet. I do not use Altair, only Plotly

I do not know if it helps but if I install 1.14.1 (which does not give an error) my charts come out huge. So I need to go back to 1.14.0.

Thanks

Fabio

Hm let me try with a plotly chart. Thanks for the update. For the charts coming out huge, there was a bug when you full screen and exit out of fullscreen, it will maintain its fullscreen size which was fixed in 1.14.1 so it’s odd that your charts are coming out huge.

If you can, a code snippet for me to reproduce and find the bug would be extremely helpful!

Thanks,

William

Hm I tried reproducing the issue by installing streamlit 1.15.0 and 1.14.1 and I couldn’t reproduce it with the following code:

import streamlit as st
import numpy as np
import plotly.figure_factory as ff

# Add histogram data
x1 = np.random.randn(200) - 2
x2 = np.random.randn(200)
x3 = np.random.randn(200) + 2

# Group data together
hist_data = [x1, x2, x3]

group_labels = ['Group 1', 'Group 2', 'Group 3']

# Create distplot with custom bin_size
fig = ff.create_distplot(
        hist_data, group_labels, bin_size=[.1, .25, .5])

# Plot!
st.plotly_chart(fig, use_container_width=True)

We have been doing some plotly changes and other such charting library changes so would love any code snippets for me to reproduce and debug.

Thanks,

William.

Hi,

It is difficult to give you a snippet because my python file is 35000 row long so I do not know where to start. :frowning:

Here is the image of the normal chart (1.14.0)

and this is the huge one (1.14.1)

Hope this helps

Fabio

your plotly code code seems work with my installation both with 1.14.1

but crashes with 1.15.

I guess the huge chart and the 1.15 install error are different animals :slight_smile:

Best

Fabio

Ah dang. Is it possible to uninstall streamlit and reinstall streamlit? Such a weird thing!

I ran pip uninstall streamlit and pip install streamlit but it does not help :wink:

Hi William,

what happens here with version 1.15 is tied to my installation, not to my app. I have taken your snippet that works with Plotly above, called it test and it runs fine on 1.14.1.

If I then try upgrade to 1.15.0 and run the test.py app I again have same the error shown before

I have upgraded Pandas, Plotly and Altair to no avail

As for the huge chart problem I have tried with a Plotly bar example and with 14.0 and 14.1 it is the same.

import streamlit as st
import numpy as np
import plotly.figure_factory as ff

import plotly.graph_objects as go

colors = ['lightslategray',] * 5
colors[1] = 'crimson'

fig = go.Figure(data=[go.Bar(
x=['Feature A', 'Feature B', 'Feature C',
'Feature D', 'Feature E'],
y=[20, 14, 23, 25, 22],
marker_color=colors # marker color can be a single color value or an iterable
)])
fig.update_layout(title_text='Least Used Feature')

# Plot!
st.plotly_chart(fig, use_container_width=False)

Instead in my app I get these two different outputs.

and

Thanks!

Fabio

Hi @Fabio ,

Thanks for the replies. I haven’t been able to look into the plotly chart thing but we did some recent changes in order to make performance for plotly charts better.

As for the streamlit error, I was recently doing some debugging on this. It looks like if you upgrade your protobuf package >= 3.20.0, this should resolve your issue.

Hi @willhuang

The protobuf thing works and the 1.15.0 installs thanks!

The issue with the “huge charts” is that I use “use_container_width=False” and I possibly with the new version it does not take into consideration the “width” value I try to pass.

Thanks !

Fabio

Hi @willhuang,

I saw just now that there is a 1.15.1 version. You guys really are amazing and Streamlit is my favorite library!

Unfortunately 1.15.1 does not solve my huge charts problem.

I need to control the width of my plotly charts so I plot all my charts with the use_container_width parameter set to False.

st.plotly_chart(fig,use_container_width=False,config=configPlotlyDict) 

With version 1.14.0 I get this

With version 1.15.1 I get this (considerably less pretty :grinning: )

Of course no problem skiping 1.15, but please fix it sooner or later :slight_smile:

Best

Fabio

Hi @Fabio ,

the reason why this chart is showing up like this was to solve a performance issue when rerendering plotly charts on streamlit. Can you create a bug here in order to track it and see when we are working on it. I’ll try to see if this is an easy fix but not sure when I can get to it.

Thanks,

William

Hi @willhuang

I opened it here use_container_width parameter of st.plotly_chart stopped working with version 1.14.1 · Issue #5761 · streamlit/streamlit · GitHub . Hope it is OK.

Thanks !

Fabio

Hi @Fabio ,

I just submitted a fix for this in 1.15.2. let me know if this fixes what u were looking for.

Thanks,

William

Hi @William,

Amazing! Work fine now!

Thanks a million!

Fabio