can not find cause of st.experimental_user deprecation warning

Hi,
I’m building an app on Streamlit 1.45 that uses the builtin authentication via OIDC with Auth0 as provider.

Overall login experience works fine but sometimes I get the yellow warning messages saying:

Please replace st.experimental_user with st.user.
st.experimental_user will be removed after 2025-11-06.

I’ve checked that my application code does not use the deprecated field but I suspect some of the modules in the requirements that are used under the hood still use the old experimental implementation. My requirements are the following:
st-annotated-text==4.0.2
streamlit==1.45.0
streamlit-card==1.0.2
streamlit-embedcode==0.1.2
streamlit-extras==0.6.0
streamlit-faker==0.0.3
streamlit-highcharts==0.2.0
streamlit-image-coordinates==0.1.9
streamlit-keyup==0.3.0
streamlit-toggle-switch==1.0.2
streamlit-vertical-slider==2.5.5

Is there a way to find out where the warning is generated?

Test each package separately. The older packages are the main suspects.

You may find a better way if you narrow down “sometimes I get the yellow warning messages” to a specific user action performed in specific circunstances, a.k.a a reproducible issue.

Unfortunately, providing a reproducible issue is not easy. The issue often seems to occur when I’m using a breakpoint to stop the execution of the application in debugging sessions. I’ll try to build a minimal example, but as I can not identify any piece of my code responsible for the issue, I don’t have a way to isolate it.

I’ve tried a bit of digging, but don’t see anything obvious in any of those libraries that seems to be using st.experimental_user. One approach you might take is unpinning the specific versions and trying to upgrade all the packages to the latest versions, and see if that resolves the warning.

Maybe try to monkeypatch streamlit.user_info.maybe_show_deprecated_user_warning so that it raises an exception and you get a traceback.

1 Like

To debugging. It’s an art and acquired skill. If it was easy, everyone would be doing it. If I ever get there, I’ll let you know.

I also have this warning - I was using version 1.45.1 of streamlit and rolled back to 1.44.1 and now don’t get the warning.. not that it’s any reassurance as the warning may have just been introduced.. None of my code contains the st.experimental_user call..

Hi ! Did you manage to solve that?
I am having the same problem here…

streamlit==1.45.1
streamlit-echarts==0.4.0
streamlit-float==0.3.5
streamlit-text-rating==0.1.5
plotly==6.1.2

This happens when I try to execute the following command:

from pygwalker.api.streamlit import StreamlitRenderer

renderer = StreamlitRenderer(data, gid=key)

Actually, running that code with those requirements raises ModuleNotFoundError, as expected.

Hello,

I cannot say for other folks.

@Daniel66

But, the warning with pygwalker and Streamlit integration is due to following code in pygwalker:

The method hooks into the tornado Application instance with the help of Python garbage collector and adds the necessary handlers to the tornado Application instance for pygwalker.

Here’s related issues on streamlit:

I started seeing this warning right after adding a functionnality that calls gc.collect() and gc.get_objects(). This seems to be the culprit here.

Hi Giovanni2 and others! I used this code:

import streamlit.user_info

def raise_exception_instead_of_warning(*args, **kwargs):
    """This function will replace the original Streamlit function."""
    raise Exception("MONKEY-PATCH: CULPRIT FOUND! Check the traceback above.")

streamlit.user_info.maybe_show_deprecated_user_warning = raise_exception_instead_of_warning

It leads me to gc.get_objects(). It “catches” every element (the st.experimetal_user element as well) which exists in the streamlit structure, so I guess when the st.experimetal_user will be removed it would not rise any exception.
If I’m wrong I would be glad if anybody correct me :smiley:

2 Likes

Same issue here with the pgwalker integration. As a quck fix, can I filter out the warning somehow? Adding

import warnings
warnings.filterwarnings(
    "ignore",
    message=".*st\.experimental_user.*will be removed.*",
    category=DeprecationWarning
)

to the start of my app does not achieve anything. It’s probably not a regular warning, is it?

Very nice inspection indeed. Will wait for it to be removed.

def no_op(*args, **kwargs):
    """This function replaces the original one and does not perform any action."""
    pass
streamlit.user_info.maybe_show_deprecated_user_warning = no_op

this one worked for me

2 Likes