Streamlit set_page_config does not work


the function st.set_page_config does not do anything for my streamlit application, any clue on why this is happening? my streamlit version is 1.24.1

Steps to reproduce

Code snippet:

# LIM streamlit app for model visualizations and simulations

import streamlit as st
import pandas as pd
import os
from os.path import join
import time
import shutil
# import numpy as np
from engine.settings import DATA_DIR
from zipfile import ZipFile
model_dirs = None

    page_title="Model Configuration",

## upload lim model from the zip file----
st.markdown("# Upload Model File")
uploaded_file = st.file_uploader(":sparkle: Load your LIM models", type = 'zip')

def upload_model_data():
    # dump the file to data directory
    with ZipFile(uploaded_file, 'r') as zip_ref:
        zip_file_name = zip_ref.filename.replace('.zip', '')
        save_dir = join(DATA_DIR, zip_file_name)
        if os.path.exists(save_dir):
           shutil.rmtree(save_dir, ignore_errors=True)


    model_parent_dir = join(save_dir, 'model')
    list_dirs = {name:join(model_parent_dir, name) for name in os.listdir(model_parent_dir)}
    model_dirs = {name:path for name, path in list_dirs.items() if os.path.isdir(path)}
    return model_dirs

if uploaded_file is not None:
    model_dirs = upload_model_data()

if model_dirs is not None:
    # select model----
    st.markdown('# Choose Model')
    selected_model = st.selectbox('Select Model', options=list(model_dirs.keys()))

    if selected_model:
        run = st.button('Load Model')
        if run:
            st.session_state['load_model'] = True
            placeholder = st.empty()
            with placeholder.container():
                st.write('model is loaded!')

            st.session_state['selected_model_path'] = model_dirs[selected_model]


If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Explain what you expect to happen when you run the code above.

Actual behavior:

Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.

Debug info

  • Streamlit version: (get it with $ streamlit version)
  • Python version: (get it with $ python --version)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version:
  • Browser version:

Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.


  • Link to your GitHub repo:
  • Link to your deployed app:

Additional information

If needed, add any other context about the problem here.

Hi @elaine50596,

Thanks for posting and welcome to the Streamlit Community forum!

What errors are you getting on your end? I ran your code and it seems to work:

Hi @tonykip , I am not getting any error, it is just that I am noticing the st.set_config_page does not apply the configs. For example I am expecting to see that the page Title name should be changed to ‘Model Configuration’, but instead I am seeing it shows the .py file name.

Hi @elaine50596,

Can you share a full screenshot that’s not cropped at the top?

One thing to look for – if one of your imports actually runs streamlit commands, that could interfere with st.set_page_config, since it needs to be the first command run in your app.

1 Like

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