Why does it re-run ? odd behavior

Hi, my st.slider causes my streamlit app to rerun. I tried to find out what is what and ended up with this code for testing purpose and i came to conclusion that is something wrong with st.slider. But im maybe wrong.

this is my full code.

from typing import List, Tuple
import pandas as pd
import plotly.express as px
import streamlit as st
import pickle
from pathlib import Path
import datetime as dt
from datetime import datetime
from datetime import date
from streamlit_option_menu import option_menu
import numpy as np
import folium
import branca
import branca.colormap as cm
from branca.colormap import linear
import plotly.graph_objects as go
from streamlit_folium import st_folium
import streamlit_authenticator as stauth
import warnings
import io
import time
from annotated_text import annotated_text
from streamlit_extras.dataframe_explorer import dataframe_explorer 
import altair as alt
# from vega_datasets import data


st.set_page_config(page_title="Dashboard", page_icon=":bar_chart:", layout="wide")

# ---- HIDE STREAMLIT STYLE ----
hide_st_style = """
            <style>
            #MainMenu {visibility: hidden;}
            footer {visibility: hidden;}
            header {visibility: hidden;}
            </style>
            """
st.markdown(hide_st_style, unsafe_allow_html=True)   

with st.sidebar:
    st.header("Configuration")
    uploaded_file = st.file_uploader("Choose a file")

if uploaded_file is None:
    st.info(" Upload a file through config", icon="ℹ️")
    st.stop()

@st.cache_data
def load_data(path: str):
    df = pd.read_csv(path, engine="pyarrow")        # IMPORTANT !!! - to read DATA !!!!
    df[["PuCity State", "PuZip"]] = df["PickUp"].str.rsplit(" ", n=1, expand=True)  # Split to City, State and Zip for Outbound | Outbound = Pick Up & P=PU
    df[["PuCity", "PuState"]] = df["PuCity State"].str.rsplit(" ", n=1, expand=True) 
    df[["DelCity State", "DelZip"]] = df["Delivery"].str.rsplit(" ", n=1, expand=True)   # Split to City, State and Zip for Inbound | Inbound = Delivery & D=Del
    df[["DelCity", "DelState"]] = df["DelCity State"].str.rsplit(" ", n=1, expand=True) 
    df[["PuCity State", "PuZip"]] = df["PickUp"].str.rsplit(" ", n=1, expand=True)  # Split to City, State and Zip for Outbound | Outbound = Pick Up & P=PU
    df[["PuCity", "PuState"]] = df["PuCity State"].str.rsplit(" ", n=1, expand=True)   # State and Zip split to Stat, Zip
    df[["DelCity State", "DelZip"]] = df["Delivery"].str.rsplit(" ", n=1, expand=True)   # Split to City, State and Zip for Inbound | Inbound = Delivery & D=Del
    df[["DelCity", "DelState"]] = df["DelCity State"].str.rsplit(" ", n=1, expand=True)   # State and Zip split to Stat, Zip
    df['PuDate'] = pd.to_datetime(df['PuDate'])
    return df

df = load_data(uploaded_file)

#Date , Miles, Weight columns
col1, col2, col3, col4 = st.columns((4))
with col1:
    startDate = pd.to_datetime(st.date_input("Start Date", pd.to_datetime(df["PuDate"]).min()))
with col2:
    endDate = pd.to_datetime(st.date_input("End Date", pd.to_datetime(df["PuDate"]).max()))
with col3:
    svoris = st.slider('Weight', min_value=df["Weight"].min(), max_value=df["Weight"].max(), value=[df["Weight"].min(), df["Weight"].max()])
with col4:
    mylios = st.slider('Miles', min_value=df["Miles"].min(), max_value=df["Miles"].max(), value=[df["Miles"].min(), df["Miles"].max()])
filtered_df = df[(df["PuDate"] >= startDate) & (df["PuDate"] <= endDate) & (df["Weight"] >= svoris[0]) & (df["Weight"] <= svoris[1]) & (df["Miles"] >= mylios[0]) & (df["Miles"] <= mylios[1])].copy()

filter_columns = {
    "PuRegion": "Region",
    "PuMarket": "Market",
    "PuState": "State",
}
st.sidebar.header("Choose your filter")

# Loop through all the columns
filtered_df = filtered_df.copy()
for column, prompt in filter_columns.items():
    choices = st.sidebar.multiselect(f"Pick your {prompt}", options=sorted(set(filtered_df[column].values)))
    if choices:
        filtered_df = filtered_df[filtered_df[column].isin(choices)]
filtered_df = filtered_df.reset_index()

st.header("")
# filtered_df = st.data_editor(filtered_df, num_rows="dynamic", height=500)
st.dataframe(filtered_df)

Streamlit versions 1.27.0 / 1.27.1 / 1.27.2 / 1.28.0 behave in the same manner as i thought it might be version problem so i started to go trough version but encountering same problem.

OS. Arch Linux

Thank You.

Actually even st.number_input reruns .
Minimized my code to bare min.

with st.sidebar:
    st.header("Configuration")
    uploaded_file = st.file_uploader("Choose a file")

if uploaded_file is None:
    st.info(" Upload a file through config", icon="ℹ️")
    st.stop()

@st.cache_data
def load_data(path: str):
    df = pd.read_csv(path, engine="pyarrow")        # IMPORTANT !!! - to read DATA !!!!
    df['PuDate'] = pd.to_datetime(df['PuDate'])
    return df

df = load_data(uploaded_file)

#Date , Miles, Weight columns
col1, col2, col3, col4 = st.columns((4))

with col1:
    startDate = pd.to_datetime(st.date_input("Start Date", pd.to_datetime(df["PuDate"]).min()))
with col2:
    endDate = pd.to_datetime(st.date_input("End Date", pd.to_datetime(df["PuDate"]).max()))
with col3:
    minSvoris = st.number_input('Weight', min_value=df["Weight"].min(), placeholder="Select min weight value...")
    # svoris = st.slider('Weight', min_value=df["Weight"].min(), max_value=df["Weight"].max(), value=[df["Weight"].min(), df["Weight"].max()])
with col4:
    maxSvoris = st.number_input('Weight', min_value=df["Weight"].min(), max_value=df["Weight"].max(), placeholder="Select max weight value...")

    # mylios = st.slider('Miles', min_value=df["Miles"].min(), max_value=df["Miles"].max(), value=[df["Miles"].min(), df["Miles"].max()])
filtered_df = df[(df["PuDate"] >= startDate) & (df["PuDate"] <= endDate) & (df["Weight"] >= minSvoris) & (df["Weight"] <= maxSvoris)].copy()

filter_columns = {
    "PuRegion": "Region",
    "PuMarket": "Market",

}
st.sidebar.header("Choose your filter")

# Loop through all the columns
filtered_df = filtered_df.copy()
for column, prompt in filter_columns.items():
    choices = st.sidebar.multiselect(f"Pick your {prompt}", options=sorted(set(filtered_df[column].values)))
    if choices:
        filtered_df = filtered_df[filtered_df[column].isin(choices)]
filtered_df = filtered_df.reset_index()

st.header("")
# filtered_df = st.data_editor(filtered_df, num_rows="dynamic", height=500)
st.dataframe(filtered_df)
#Loop through all the columns
filtered_df = filtered_df.copy()
for column, prompt in filter_columns.items():
    choices = st.sidebar.multiselect(f"Pick your {prompt}", options=sorted(set(filtered_df[column].values)))
    if choices:
        filtered_df = filtered_df[filtered_df[column].isin(choices)]
filtered_df = filtered_df.reset_index()

This is a culprit for Streamlit to re-run and remove selected option once i choose slider or number_input .

This issue was not there yesterday.
It can be due to OS update or something with Streamlit. ?

I tested on my older version of OS and i have same issue.

From the docs (emphasis added):

any time something must be updated on the screen, Streamlit reruns your entire Python script from top to bottom.

This can happen in two situations:

  • Whenever you modify your app’s source code.

  • Whenever a user interacts with widgets in the app. For example, when dragging a slider, entering text in an input box, or clicking a button.

2 Likes

Sorry, i might have not explained correctly: This is my issue. Re-runs twice and removes selected fields, only slider position is not changed.
This is my log from debug.

2023-11-06 18:58:42.909 Received the following back message:
rerun_script {
  widget_states {
    widgets {
      id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
      double_array_value {
        data: 14045
        data: 43250
      }
    }
    widgets {
      id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
      double_array_value {
        data: 139.1
        data: 3325.2
      }
    }
    widgets {
      id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
      int_array_value {
        data: 3
      }
    }
    widgets {
      id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
      string_array_value {
        data: "2019/01/24"
      }
    }
    widgets {
      id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
      string_array_value {
        data: "2023/05/12"
      }
    }
    widgets {
      id: "$$WIDGET_ID-cf798affaf0006ed5072473329387805-None"
      string_value: ""
    }
    widgets {
      id: "$$WIDGET_ID-7808fe4b7d955ff459ebf91d366e40b1-column_change"
      int_value: 0
    }
    widgets {
      id: "$$WIDGET_ID-83a891f61a7cbaef4b35ab854d6cbda0-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-cb3aec2d5a4353e8b30fbe2e7e997dd1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-fb174e54c685099b2d11f29ade91f5f4-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-9cbb61dcf7e94476dcdde5842ac9e0bb-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-2bdaa4f9d11ac8d9956b8ea880e840c5-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-7a4cfbc6512ad70fc435627e529614ca-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-8871f884f4e4121d761c897d3d42d4b4-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-335fa823e7ca79ea9ca7909ef7957805-None"
      int_array_value {
      }
    }
  }
  page_script_hash: "a20f14ed3497e283738c94bc9e50ef53"
}

2023-11-06 18:58:42.910 Beginning script thread
2023-11-06 18:58:42.910 Running script RerunData(widget_states=widgets {
  id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
  double_array_value {
    data: 14045
    data: 43250
  }
}
widgets {
  id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
  double_array_value {
    data: 139.1
    data: 3325.2
  }
}
widgets {
  id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
  int_array_value {
    data: 3
  }
}
widgets {
  id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
  string_array_value {
    data: "2019/01/24"
  }
}
widgets {
  id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
  string_array_value {
    data: "2023/05/12"
  }
}
widgets {
  id: "$$WIDGET_ID-cf798affaf0006ed5072473329387805-None"
  string_value: ""
}
widgets {
  id: "$$WIDGET_ID-7808fe4b7d955ff459ebf91d366e40b1-column_change"
  int_value: 0
}
widgets {
  id: "$$WIDGET_ID-83a891f61a7cbaef4b35ab854d6cbda0-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-cb3aec2d5a4353e8b30fbe2e7e997dd1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-fb174e54c685099b2d11f29ade91f5f4-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-9cbb61dcf7e94476dcdde5842ac9e0bb-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-2bdaa4f9d11ac8d9956b8ea880e840c5-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-7a4cfbc6512ad70fc435627e529614ca-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-8871f884f4e4121d761c897d3d42d4b4-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-335fa823e7ca79ea9ca7909ef7957805-None"
  int_array_value {
  }
}
, page_script_hash='a20f14ed3497e283738c94bc9e50ef53')
2023-11-06 18:58:42.911 Disconnecting files for session with ID eb889f6b-01a3-442f-a749-380e7643e1de
2023-11-06 18:58:42.911 Sessions still active: dict_keys([])

There seems to be only one rerun in your logs. I ran your allegedly bare min code with made up data. Interacting with either number_input triggers only one rerun. I see no slider. The selectboxes in the side bar are reset in each rerun because the options change, so they are new widgets each time.

1 Like

Did slider reset you chosen field ? and showed only sliders info ?
Because if i select lets say CA and slide slider - CA lied selection is gone and shows only sliders info - no more CA field selection.

As I said, I didn’t see any sliders. I didn’t see “CA” either, maybe it is in your data, but I don’t have it.

Yeah i know u dont see CA its in my code - its a State… and sorry, not slider, but select box.
Some code below.
Sorry, i think i pasted not full code last time.
I started streamlit, i selected one field. This is the code i got.

streamlit run Home.py --logger.level=debug                                                                                     [9/11/23| 8:55AM]
2023-11-09 08:57:03.638 No singleton. Registering one.
2023-11-09 08:57:03.826 Watcher created for /koaladb/koala/pages
2023-11-09 08:57:03.827 Starting server...
2023-11-09 08:57:03.827 Serving static content from /koaladb/koala/lib/python3.11/site-packages/streamlit/static
2023-11-09 08:57:03.950 Server started on port 8501
2023-11-09 08:57:03.950 Runtime state: RuntimeState.INITIAL -> RuntimeState.NO_SESSIONS_CONNECTED

  You can now view your Streamlit app in your browser.

  Local URL: http://localhost:8501
  Network URL: http://192.168.1.27:8501

2023-11-09 08:57:04.048 Skipping PyPI version check
2023-11-09 08:57:04.048 Setting up signal handler
2023-11-09 08:57:05.305 Watcher created for /koaladb/koala/Home.py
2023-11-09 08:57:05.306 AppSession initialized (id=667d6eab-9123-41ca-b0a3-90dbb0f5d82b)
2023-11-09 08:57:05.306 Created new session for client 140537525458192. Session ID: 667d6eab-9123-41ca-b0a3-90dbb0f5d82b
2023-11-09 08:57:05.306 Runtime state: RuntimeState.NO_SESSIONS_CONNECTED -> RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED
2023-11-09 08:57:05.312 Received the following back message:
rerun_script {
  widget_states {
  }
}

2023-11-09 08:57:05.314 Beginning script thread
2023-11-09 08:57:05.314 Running script RerunData(widget_states=)
2023-11-09 08:57:05.315 Disconnecting files for session with ID 667d6eab-9123-41ca-b0a3-90dbb0f5d82b
2023-11-09 08:57:05.315 Sessions still active: dict_keys([])
2023-11-09 08:57:05.315 Files: 0; Sessions with files: 0
2023-11-09 08:57:05.794 Creating new DataCache (key=0d8ee2732a18e1fa1a64e5a4c04a93ee, persist=None, max_entries=None, ttl=None)
2023-11-09 08:57:05.795 Cache key: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:05.795 Memory cache MISS: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:05.795 Memory cache MISS: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:05.819 Memory cache MISS: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:05.838 Removing orphaned files...
2023-11-09 08:57:06.026 Watcher created for /koaladb/koala/bin/streamlit
2023-11-09 08:57:06.038 Script run finished successfully; removing expired entries from MessageCache (max_age=2)
2023-11-09 08:57:13.119 Received the following back message:
rerun_script {
  widget_states {
    widgets {
      id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
      string_array_value {
        data: "2019/01/24"
      }
    }
    widgets {
      id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
      string_array_value {
        data: "2023/05/12"
      }
    }
    widgets {
      id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
      double_array_value {
        data: 1546
        data: 43250
      }
    }
    widgets {
      id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
      double_array_value {
        data: 139.1
        data: 3325.2
      }
    }
    widgets {
      id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
      int_array_value {
        data: 3
      }
    }
    widgets {
      id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
      int_array_value {
      }
    }
  }
  page_script_hash: "a20f14ed3497e283738c94bc9e50ef53"
}

2023-11-09 08:57:13.120 Beginning script thread
2023-11-09 08:57:13.121 Running script RerunData(widget_states=widgets {
  id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
  string_array_value {
    data: "2019/01/24"
  }
}
widgets {
  id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
  string_array_value {
    data: "2023/05/12"
  }
}
widgets {
  id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
  double_array_value {
    data: 1546
    data: 43250
  }
}
widgets {
  id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
  double_array_value {
    data: 139.1
    data: 3325.2
  }
}
widgets {
  id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
  int_array_value {
    data: 3
  }
}
widgets {
  id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
  int_array_value {
  }
}
, page_script_hash='a20f14ed3497e283738c94bc9e50ef53')
2023-11-09 08:57:13.121 Disconnecting files for session with ID 667d6eab-9123-41ca-b0a3-90dbb0f5d82b
2023-11-09 08:57:13.121 Sessions still active: dict_keys([])
2023-11-09 08:57:13.121 Files: 0; Sessions with files: 0
2023-11-09 08:57:13.126 Cache key: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:13.126 Memory cache HIT: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:13.151 Removing orphaned files...
2023-11-09 08:57:13.222 Script run finished successfully; removing expired entries from MessageCache (max_age=2)
2023-11-09 08:57:13.996 Watcher created for /koaladb/koala/Home.py
2023-11-09 08:57:13.996 AppSession initialized (id=02ae5fe0-c54d-47a1-b86c-aa7a0f671613)
2023-11-09 08:57:13.996 Created new session for client 140537506002256. Session ID: 02ae5fe0-c54d-47a1-b86c-aa7a0f671613
2023-11-09 08:57:13.996 Runtime state: RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED -> RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED
2023-11-09 08:57:14.049 Received the following back message:
rerun_script {
  widget_states {
    widgets {
      id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
      string_array_value {
        data: "2019/01/24"
      }
    }
    widgets {
      id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
      string_array_value {
        data: "2023/05/12"
      }
    }
    widgets {
      id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
      double_array_value {
        data: 1546
        data: 43250
      }
    }
    widgets {
      id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
      double_array_value {
        data: 139.1
        data: 3325.2
      }
    }
  }
  page_script_hash: "a20f14ed3497e283738c94bc9e50ef53"
}

2023-11-09 08:57:14.050 Beginning script thread
2023-11-09 08:57:14.051 Running script RerunData(widget_states=widgets {
  id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
  string_array_value {
    data: "2019/01/24"
  }
}
widgets {
  id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
  string_array_value {
    data: "2023/05/12"
  }
}
widgets {
  id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
  double_array_value {
    data: 1546
    data: 43250
  }
}
widgets {
  id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
  double_array_value {
    data: 139.1
    data: 3325.2
  }
}
, page_script_hash='a20f14ed3497e283738c94bc9e50ef53')
2023-11-09 08:57:14.051 Disconnecting files for session with ID 02ae5fe0-c54d-47a1-b86c-aa7a0f671613
2023-11-09 08:57:14.051 Sessions still active: dict_keys([])
2023-11-09 08:57:14.051 Files: 0; Sessions with files: 0
2023-11-09 08:57:14.054 Cache key: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:14.054 Memory cache HIT: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:14.078 Removing orphaned files...
2023-11-09 08:57:14.269 Watcher created for /koaladb/koala/bin/streamlit
2023-11-09 08:57:14.281 Script run finished successfully; removing expired entries from MessageCache (max_age=2)
2023-11-09 08:57:17.054 Watcher created for /koaladb/koala/Home.py
2023-11-09 08:57:17.055 AppSession initialized (id=7057cfb4-b054-40be-8ecd-2ac70ad08203)
2023-11-09 08:57:17.055 Created new session for client 140537509281424. Session ID: 7057cfb4-b054-40be-8ecd-2ac70ad08203
2023-11-09 08:57:17.055 Runtime state: RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED -> RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED
2023-11-09 08:57:17.068 Watcher created for /koaladb/koala/Home.py
2023-11-09 08:57:17.068 AppSession initialized (id=0e017f5f-c695-454f-8dd9-2784a634a456)
2023-11-09 08:57:17.068 Created new session for client 140537509275344. Session ID: 0e017f5f-c695-454f-8dd9-2784a634a456
2023-11-09 08:57:17.068 Runtime state: RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED -> RuntimeState.ONE_OR_MORE_SESSIONS_CONNECTED
2023-11-09 08:57:17.101 Received the following back message:
rerun_script {
  widget_states {
    widgets {
      id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
      string_array_value {
        data: "2019/01/24"
      }
    }
    widgets {
      id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
      string_array_value {
        data: "2023/05/12"
      }
    }
    widgets {
      id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
      double_array_value {
        data: 11463
        data: 43250
      }
    }
    widgets {
      id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
      double_array_value {
        data: 139.1
        data: 3325.2
      }
    }
    widgets {
      id: "$$WIDGET_ID-89e11c1b0b050e1ce59c6d59bebcb48f-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-58ad8d8056c9e8717dc89bab15763daa-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-95580e1a8c36e4a659fea78804024fde-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-7c8ea7b1dbf423042b8de5b6b183bae9-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-a457632d0f8dd97a016f8652c453385b-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
      int_array_value {
      }
    }
  }
  page_script_hash: "a20f14ed3497e283738c94bc9e50ef53"
}

2023-11-09 08:57:17.102 Beginning script thread
2023-11-09 08:57:17.102 Running script RerunData(widget_states=widgets {
  id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
  string_array_value {
    data: "2019/01/24"
  }
}
widgets {
  id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
  string_array_value {
    data: "2023/05/12"
  }
}
widgets {
  id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
  double_array_value {
    data: 11463
    data: 43250
  }
}
widgets {
  id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
  double_array_value {
    data: 139.1
    data: 3325.2
  }
}
widgets {
  id: "$$WIDGET_ID-89e11c1b0b050e1ce59c6d59bebcb48f-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-58ad8d8056c9e8717dc89bab15763daa-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-95580e1a8c36e4a659fea78804024fde-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-7c8ea7b1dbf423042b8de5b6b183bae9-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-a457632d0f8dd97a016f8652c453385b-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
  int_array_value {
  }
}
, page_script_hash='a20f14ed3497e283738c94bc9e50ef53')
2023-11-09 08:57:17.102 Disconnecting files for session with ID 7057cfb4-b054-40be-8ecd-2ac70ad08203
2023-11-09 08:57:17.102 Sessions still active: dict_keys([])
2023-11-09 08:57:17.102 Files: 0; Sessions with files: 0
2023-11-09 08:57:17.105 Cache key: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:17.106 Memory cache HIT: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:17.127 Removing orphaned files...
2023-11-09 08:57:17.324 Watcher created for /koaladb/koala/bin/streamlit
2023-11-09 08:57:17.324 Received the following back message:
rerun_script {
  widget_states {
    widgets {
      id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
      string_array_value {
        data: "2019/01/24"
      }
    }
    widgets {
      id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
      string_array_value {
        data: "2023/05/12"
      }
    }
    widgets {
      id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
      double_array_value {
        data: 1546
        data: 43250
      }
    }
    widgets {
      id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
      double_array_value {
        data: 139.1
        data: 3325.2
      }
    }
    widgets {
      id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
      int_array_value {
      }
    }
    widgets {
      id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
      int_array_value {
      }
    }
  }
  page_script_hash: "a20f14ed3497e283738c94bc9e50ef53"
}

2023-11-09 08:57:17.325 Beginning script thread
2023-11-09 08:57:17.325 Running script RerunData(widget_states=widgets {
  id: "$$WIDGET_ID-0201fd2b0769cee9907becbd937e9028-None"
  string_array_value {
    data: "2019/01/24"
  }
}
widgets {
  id: "$$WIDGET_ID-35eafaf9d97e5d9aee7f36db72148a3a-None"
  string_array_value {
    data: "2023/05/12"
  }
}
widgets {
  id: "$$WIDGET_ID-c9b55a6bb484bb6fa925f0132d9263ca-None"
  double_array_value {
    data: 1546
    data: 43250
  }
}
widgets {
  id: "$$WIDGET_ID-9aebe3d2a07c818a646fcc3b54b7f978-None"
  double_array_value {
    data: 139.1
    data: 3325.2
  }
}
widgets {
  id: "$$WIDGET_ID-bd3b01fe01901c819bf07002a6e968b3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-14807f13a6469b291e505d18d82172a3-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c4a6645e85e492c587a54b64cd5480d7-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-e32f68ed899ea7f4424a1564bf4e75f1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-f91ebe4701c75a92bfaf7ed4a83ed3cf-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-77a174cdc9ec5ddc7a5afbd57794e664-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-a29e902f528ce46ecacaa80bc14b2469-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-890d1435cd06fe5d09b97e44b2243a9c-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-c09e75805be693f5022939405669195e-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-d87848b5cfbeab1eab96377b34aef2c1-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-3ec7dda3e3f54b0b82aff3e5509d24d2-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-9899bc481a3e962d28213bbcf30174ba-None"
  int_array_value {
  }
}
widgets {
  id: "$$WIDGET_ID-b3da5e2ae25dbcb3fdf5fe741ebf4bf6-None"
  int_array_value {
  }
}
, page_script_hash='a20f14ed3497e283738c94bc9e50ef53')
2023-11-09 08:57:17.325 Disconnecting files for session with ID 0e017f5f-c695-454f-8dd9-2784a634a456
2023-11-09 08:57:17.325 Sessions still active: dict_keys([])
2023-11-09 08:57:17.326 Files: 0; Sessions with files: 0
2023-11-09 08:57:17.329 Cache key: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:17.329 Memory cache HIT: d41d8cd98f00b204e9800998ecf8427e
2023-11-09 08:57:17.347 Script run finished successfully; removing expired entries from MessageCache (max_age=2)
2023-11-09 08:57:17.350 Removing orphaned files...
2023-11-09 08:57:17.513 Watcher created for /koaladb/koala/bin/streamlit
2023-11-09 08:57:17.525 Script run finished successfully; removing expired entries from MessageCache (max_age=2)

Minimal code im running for debugging i removed few filtered lines and this code is 3 filters ( instead of 13 ), 2 sliders and date pickers.:

col1, col2, col3, col4 = st.columns((4))
with col1:
    startDate = pd.to_datetime(st.date_input("Start Date", pd.to_datetime(df["PuDate"]).min()))
with col2:
    endDate = pd.to_datetime(st.date_input("End Date", pd.to_datetime(df["PuDate"]).max()))
with col3:
    svoris = st.slider('Weight', min_value=df["Weight"].min(), max_value=df["Weight"].max(), value=[df["Weight"].min(), df["Weight"].max()])
with col4:
    mylios = st.slider('Miles', min_value=df["Miles"].min(), max_value=df["Miles"].max(), value=[df["Miles"].min(), df["Miles"].max()])
filtered_df = df[(df["PuDate"] >= startDate) & (df["PuDate"] <= endDate) & (df["Weight"] >= svoris[0]) & (df["Weight"] <= svoris[1]) & (df["Miles"] >= mylios[0]) & (df["Miles"] <= mylios[1])].copy()

filter_columns = {
    "Region": "Region",
    "Market": "Market",
    "State": "State",

}
st.sidebar.header("Choose your filter")

# Loop through all the columns
filtered_df = filtered_df.copy()
for column, prompt in filter_columns.items():
    choices = st.sidebar.multiselect(f"Pick your {prompt}", options=sorted(set(filtered_df[column].values)))
    if choices:
        filtered_df = filtered_df[filtered_df[column].isin(choices)]
filtered_df = filtered_df.reset_index()

I installed Debian 12 on my laptop to check it. Same. Created new python ven - same problem, but i can use my Weight, Miles and Region all together, but if i choose Region, Market, State and use sliders - in selected field stays only Market and sliders and all info about Market and State - disappears.

Im using Python 3.11.5

To be honest, I don’t know what to make of those logs.

Regarding your code, I don’t see anything unexpected when I run it. The multiselect widgets sometimes are reset and your selections dissapear, as I already said that is expected because you are changing the options of those widgets.

If you issue is something else, I am afraid I don’t understand it.