AttributeError: module 'streamlit' has no attribute 'query_params'

I’m playing around with this code to understand it. I saw in the streamlit documentation that st.experimental_set_query_params is being depreciated, and to use st.query_params, but in my code st.query_params does not work.

my input:

import streamlit as st
st.query_params['test'] = 1
st.write("Done")
st.stop()

The other chat where this question was asked got shut down before I could ask the clarifying question, "what code did they get to work by refreshing their browser, st.query_prams or st.experimental_set_query_params?

I refreshed my code and the st.query_params still does not work. The error I’m getting is down below. However, the st.experimental_set_query_params is working perfectly fine. I’m wondering if am I doing something wrong or if the st.query_params is not up and running correctly yet.

Ps. I know st.experimental_set_query_params works, but I am seeking to get clarity on the depreciation notice and my error with the new code.

code error:

 1 import streamlit as st
----> 2 st.query_params['test'] = 1
      3 st.write("Done")
      4 st.stop()

AttributeError: module 'streamlit' has no attribute 'query_params'

Thanks in advance for your support!

Hi starseed,

you have updated the streamlit version to 1.30?

Óscar

I have the same problem
I’m using version 1.31

It should work if you’re on Streamlit version 1.30 or later. Is there any chance there’s a mix-up of your environments? If you look at the running app showing the error, what do you see in the “About” section of the App menu?

That will confirm for certain which version of Streamlit the app is running with in case you have multiple environments/Python versions on your computer.

That is a different error, unrelated to the OP.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.