Can we limit the st.cache dependecies?

Our teammate has run into issues with too many file descriptors being open at the same time in the code and issues with linux having a limit on how many files can be watched. Is there a way to exclude things such as directories being watched to mitigate this issue?

1 Like

The exact error is:
OSError: inotify instance limit reached

This happened with a medium sized virtual environment containing numpy, pandas and pytorch. It runs into Linux’s setting fs.inotify.max_user_watches which limits the number of concurrent watches the OS can handle.

1 Like

Great question! I believe the answer is setting:

[global]
folderWatchBlacklist = ['*']

in either ~/.streamlit/config.toml or ~/.streamlit/config.toml.

To quote from the streamlit config show option:

# List of folders that should not be watched for changes. This impacts both "Run on Save" and @st.cache.
# Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
folderWatchBlacklist = []

Please let us know if that works!

I’ve added the following content to ~/.streamlit/config.toml:

[server]
folderWatchBlacklist = ["*"]

I still get the same error message.

Work-around: Increasing the limit and restarting - https://stackoverflow.com/a/47094674/562769

1 Like