Error after installing new version (84)

Hello,

O just installed the new version, and from time to time, when I change the dataset I am working with, I get this error.

I suspect is has something to do with the session state thing (that I have not implemented yet in any way). Can anybody point me in the right direction?

Many thanks!

Fabio

I also noticed that the new version behaves differently, so my old code does not work anymore and I had to downgrade.

Before I would change the value in a widget, and then click the “run” button and it would rerun.

Now if I change the value in a widget and click “run” nothing happens.

It must be tied to something wrong I did in the implementation of the app, but I would like to upgrade but I have no idea what is going on and how to fix it.

This is the message I get in the console.

Product_Group is the column name I am trying to filter

Many thanks

Fabio

There seem to be a few breaking bugs in 0.84

It’s probably worth downgrading to 0.83 if you are affected, and able to revert your version.

Thanks!

I will wait until it is fixed.

Hey @madflier and @Fabio !

Thanks for bringing this up. It seems we made an assumption on widgets with options to be indexable, which is invalid once using dataframes. The easy workaround is to use list around the options argument. We are working on a patch release to address this in the next couple days. We have a fix for this, and you can test drive it here: https://share.streamlit.io/streamlit/core-previews/pr-3515 Just place your code in the text box and see if it’s fixed. If it’s still an issue (and it works in 0.83) let me know. Any information about what the input type in is appreciated as well.

Hi @kmcgrady,

I am not sure I understand this thing about lists.

From the comments the problem appears to be “using a pandas dataframe columns attribute as the options for the multi select.”

I pass a list of that contains a subset my df’s column names to the widget and I get the error. See code I use below

Hey @Fabio !

Thanks for following up. I am wondering what type is indexColsSelectBox specifically, and I wonder if passing list(indexColsSelectBox) would be a workaround. We essentially checked if elements were "indexable "but didn’t realize that some inputs were not properly indexable.

Combining Session State with the state of widgets have proved some interesting challenges. We hope to address these all quickly!

1 Like

Hi @kmcgrady,

thanks for your help.

indexColsSelectBox is a list already. I get the list of the dataframe column names and add a “None” at the beginning of the list for the “do not filter anything” user choice.

image

Hey @Fabio , I see.

Is there a toy example I can play with to identify the issue? Essentially, the error is suggesting the value being returned is not in the list of options. I wonder if it’s a type issue (e.g. comparing None to "None", or something else. If you have an example, I’ll get down to the bottom of it.

Hi @kmcgrady,

thanks so much for your help. I am not sure how to set up the toy example.

I tried to check your idea of the app having an issue between None and “None”.

I changed “None” to the “Something else” string

image

Until I do not filter anything, until I leave “Something else” in my widget, once I click on “Submit” the app works and returns my beautiful chart.

image

The console also stays clear except for this warning message. But in my app you can choose to upload a file or to play with a test file. I am doing the latter so it is ok.

The moment I use the widget to select the column I want to filter on, for instance Country

I get an error in the Console

At that point the app freeze and nothing happens if I click on Submit. Also if try to filter on something, for example here “China”.

image

On the console nothing more happens, and the message stays the same.

I really hope this helps. Let me know if there is anything I can do to help you solve this

Thanks!

Fabio

Thanks @Fabio for that analysis! It’s really helpful. I still need to see what Streamlit is thinking the iterable is. I’ve constructed the toy example here based on the information provided, and it works, so there must be some other failure happening. indexColsSelectBox not a formal list and is say a data frame or series. Is the key changing? Is the label changing?

import streamlit as st

tooltip = """Select a column you want to filter on.
"""


indexColsSelectBox = [
  "None",
  "Material",
  "Country",
  "Channel",
  "Complication",
  "Customer",
  "Line",
  "Brand",
  "Product"
]

foo = st.selectbox("Column Label", indexColsSelectBox, help=tooltip, index=0, key="filterColumn1")

st.write(foo)

With a working broken sample script, I can run it through our debug tools. Any way we can pare down the current script into something that demonstrates the broken behavior and you can send the script for us to test?

I am super appreciative of this by the way and am loving this feedback!

Thanks @kmcgrady ,

I finally tried your first suggestion, passing list(indexColsSelectBox) instead of indexColsSelectBox and it seems to work. There are no errors in the console.

When you st.write list(indexColsSelectBox) and indexColsSelectBox they look alike but the important thing is that this works.

I have a last question. Should I wait for your new fix that avoids the need of wrapping my lists in “list()” or should I do this for all my widgets? I will implement the session state function is the near future but it is not an immediate priority for me.

Many thanks!

Fabio

Thanks @Fabio !

I’m glad we got to the bottom of it. You can try printing st.write(type(indexColsSelectBox)) and see what it produces. My guess is a data frame index.

That being said. We are targeting a fix early next week, so you should be able to get this working without the list

Thank you so much for your help and cooperation!

Nope, surprisingly it is a list!

But if I do not put it into the list() it always returns our error!

image

That’s weird. We have merged the changes in. You can try installing streamlit-nightly tonight pip install streamlit-nightly and ensure it works. We hope to get this in a patch release early next week.

Yes very strange. It is a list because I insert the “None” option in the array of the column names.

I have tried to understand what happens when ypu apply the list() function to something that is already a list but could not find an answer.

Hi @kmcgrady,

I upgraded to 84.1, but no luck.

When I load my filter…

…it immediately returns the usual error and freezes.

Thanks again for your help and time.

Fabio

Hey @Fabio I’m starting to run out of ideas. Can you provide a small example script that demonstrates this? I can test it out and figure out what’s going on.

Hi @kmcgrady ,

I fully understand and I really appreciate you efforts. However I am a self taught programmer and my app is 20000 lines long, so I would not know how to cut out a piece that replicates the error.

Since I am the only one you got this problem it must have to do with some idiosyncrasy in my code. :slight_smile:

Thanks

Fabio

Haha. Good for you @Fabio on being self-taught! Your ability to go in depth is super valuable. Let us know if you figure out the problem or have a small example for us to debug. Happy to help where I can!