Streamlit app not updating with code changes (weird cache issue?)

I’ve been running Streamlit locally, and it worked perfectly for weeks. However, today, my app suddenly stopped updating when I make code changes, unless I manually re-run the app from the console.

For example, I start the app with: streamlit run data_upload/run.py
It initially runs the newest version of the code, but any subsequent changes aren’t picked up—refreshing the page, clicking “Rerun”, clearing the browser cache, or other steps don’t help.

I’ve tried installing Watchdog and adding the following to my configuration:

[server]
fileWatcherType = "watchdog"

Despite this, the code still seems cached somehow. I can see in the console output that the old code is being executed (e.g., error messages from removed code still appear). From the logs, watchdog seems to be working fine, it recognises that file has been changed.

This started happening with 1.39.1 to I updated to the latest version (1.41.1), but still the same issue. The weirdest think is that this started happening without me installing or updating anything.

Here are version of the app and my sustem:
OS: Mac OS 15.1 (M2)
Python version: 3.12.2
Streamlit version: 1.41.1

How can I debug this?

Update: after running the app in debug mode I got following logs after updating one the files in the project (page.py):

2025-01-20 13:02:56.079 Ignoring changed path /path/to/file/pages/page.py.
Watched_paths: {‘/path/to/file/run.py’: WatchedPath(md5=‘1c2ec6b27f10e71cb8ad40265ff1c9ee’, modification_time=1737375065.0108342, on_changed=<blinker.base.Signal object at 0x103402450>)}

So it’s seems like none of my module files (except the main run.py file is in the Watched_paths). On the other hand, I can see logs like:
"Watcher created for .." for every file in the project.

Streamlit doesn’t reload site when code in container changes - Using Streamlit - Streamlit

this may help you (at least it helped me with a similar case).
See the accepted answer.

1 Like

@Marco5 I tried all that, and it still doesn’t work .
I tried:
runOnSave = true
fileWatcherType = "poll"

also with:
fileWatcherType = "watchdog"

I also tried several versions of the streamlit.