Version 1.18.0

Yes, I am getting this set_page_config error also. I am using the pages folder to define my multi-page app. The main page provides links to the individual sub-pages, via st.markdown, as they have their own url. The sub-pages have set_page_config as the 1st streamlit command to change the title etc. This worked well in 1.16, but it causes trouble in 1.18.1.

Since each page has its own url, I think the behavior of 1.16 should be the preferred behavior. The strange thing is, the error would go away if I reload the sub-pages. It feels like there has been a regression.

1 Like

Just tried to upgrade my app from 1.17.0 to 1.18.1. Upgraded from @st.cache to @st.cache_data. But something seems off. I am now getting a streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError: Key not found in mem cache error.

I have not noticed a change between 1.17 and 1.18 in my code, so it might be something completely different. But one way in which this error unexpectedly came up for me before is by importing anything with the cache decorator before st.page_config… just a hint.

1 Like

Thanks for the suggestion, ennui, but I don’t think the situation you mentioned is happening because the same code works fine under 1.16 (and 1.17 as well… I’ve just tested it).

Hi all… I think I’ve identified the problem with set_page_config. The issue comes up because of the warning about st.experimental_memo being deprecated. This warning is probably the 1st streamlit command, thus triggering the error.

I’ll report back once I’ve gotten rid of all st.experimental_memo in my production code, but in a test setup, moving to st.cache_data solved the issue. :pray:

Edit: Yes, that was the issue. Replacing all the experimental_memo/experimental_singleton solved it.

5 Likes

Nested st.columns is exactly what I needed! Thanks.

I am using 1.18.1 and st.cache_data is giving an error.
I used to use st.cache and worked well.
I guess the problem is that I am using st.cache in a class method:

class Dal:
@st.cache_data
  def get_tables(self) -> list[str]:
      return requests.get(self.config.api_host + 'data-lake/tables').json()

class App:
def __init__(self, dal):
     self.dal = dal

def run(self):
     tables = self.dal.get_tables()

Error:
TypeError: Dal.get_tables() missing 1 required positional argument: ‘self’

If I remove st.cache_data it works again.

I think this one has already been reported on GitHub and should be resolved soon: No longer able to st.cache_data instance methods · Issue #6109 · streamlit/streamlit · GitHub

1 Like

I use some helper function in all the pages, calling set_page_config only when st.session_setting["initialized"] is false. Not the most convenient way to do it but it is not too bad.

1 Like

Hello, is there a place where I can find sample code on how to use nested columns?
Thank you for your hard work

Hi @Bap, welcome to the forum! :wave:

Here’s the nested columns release demo that contains some sample code:

https://columns-in-columns.streamlit.app/

The simplest example:

import streamlit as st

col1, col2 = st.columns()

# Now add subcolumns...
subcol1, subcol2 = col1.columns()
subcol1.write("Inside a nested column 🎈")
2 Likes

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