I want the user to be able to choose maximum 3 options out of a list through multiselect.
Code:
List = st.multiselect(âSelect 3 companiesâ, companies3[ânameâ],3,key = â0123â, max_selections=3)
Error:
TypeError: multiselect() got an unexpected keyword argument âmax_selectionsâ

it seems from the above screenshot, that max_selection is not part of the code eventhough in the website they mention it
I used your code, substituting a range for the list of companies and removing the default selection of the number 3 and it ran fine for me. The first 3 you have in the line is being interpreted as the default selection (e.g. an item on your list that is selected), but I would expect that to throw a different error if it wasnât compatible with your list of companies.
st.multiselect('Select 3 companies', range(10),key ='012', max_selections=3)

If youâre still getting the error, can you post more screen shots?
Hi @Nikos_Kyriakou ,
thanks for posting your question! Welcome 
Are you sure youâre on the latest streamlit?
If you want to check for that, you can check by running streamlit --version
.
If you notice youâre not on the latest streamlit version, you can check out these docs to upgrade your streamlit.
thank you for your feedback, unfortunately the issue persist
@willhuang I reinstalled and I have the latest version the issue still persist
@mathcatsand I copy pasted your code and still get the below error
FYI not sure if this maybe the issue, I run in in Spyder through Anaconda
@Nikos_Kyriakou would you mind adding this line to your streamlit app before the multiselect?
st.write(st.__version__)
and let us know what version number it says?
Hi
It was a matter of version, I updated and now works.
It seems I was using the wrong code when updating streamlit in anaconda
2 Likes