Summary
Once I updated from 1.19 to 1.20, function specific cache clearing stopped working. Clearing the entire cache works fine. It seems to be related to the path of where the cache is stored, since it gives me this error message:
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\USERNAME\\.streamlit\\cache'
Steps to reproduce
- Add caching to a function
@st.cache_data()
def func(x):
# do something
return f"new value = {x}"
- Try to clear the funcions cache
x = st.slider('value', 0, 10, 1, 1)
y = func(x)
if st.button('press to clear cache'):
func.clear()
st.experimental_rerun()
st.write(y)
st.stop()
Expected behavior:
The cache of the function should clear, and the page should rerun
Actual behavior:
The previous error is raised
Debug info
- Streamlit version: 1.20
- Python version: 3.10.8
- Using Conda? Yes
- OS version: Windows 10
- Browser version: Google Chrome (latest)
Additional information
- When downgrading to Streamlit 1.19 the error is gone
Please let me know if I need to add more information! Thanks for the amazing work!
Cheers,
Dirk