streamlit icon indicating copy to clipboard operation
streamlit copied to clipboard

version.1.27.0: "Tried to use SessionInfo before it was initialized"

Open alexfilothodoros opened this issue 1 year ago • 9 comments

Checklist

  • [X] I have searched the existing issues for similar issues.
  • [X] I added a very descriptive title to this issue.
  • [X] I have provided sufficient information below to help reproduce this issue.

Summary

Hi everyone.

I keep getting this error with the latest streamlit version

Tried to use SessionInfo before it was initialized

I have found this https://github.com/streamlit/streamlit/issues/1282, but it's about an older version.

And this is the error in the console

Exception in callback AppSession._on_scriptrunner_event.<locals>.<lambda>() at C:\Users\AlexandrosFilothodor\anaconda3\envs\GPT\Lib\site-packages\streamlit\runtime\app_session.py:463
handle: <Handle AppSession._on_scriptrunner_event.<locals>.<lambda>() at C:\Users\...\site-packages\streamlit\runtime\app_session.py:463>
Traceback (most recent call last):
  File "C:\Users\...\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    lambda: self._handle_scriptrunner_event_on_event_loop(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users...\site-packages\streamlit\runtime\app_session.py", line 533, in _handle_scriptrunner_event_on_event_loop
    self._create_new_session_message(page_script_hash)
  File "C:\Users\...\site-packages\streamlit\runtime\app_session.py", line 641, in _create_new_session_message
    imsg.environment_info.streamlit_version = STREAMLIT_VERSION_STRING
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bad argument type for built-in operation
Exception in callback AppSession._on_scriptrunner_event.<locals>.<lambda>() at C:\Users\...\Lib\site-packages\streamlit\runtime\app_session.py:463
handle: <Handle AppSession._on_scriptrunner_event.<locals>.<lambda>() at C:\Users\...T\Lib\site-packages\streamlit\runtime\app_session.py:463>
Traceback (most recent call last):
  File "C:\Users\...\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\...\site-packages\streamlit\runtime\app_session.py", line 463, in <lambda>
    lambda: self._handle_scriptrunner_event_on_event_loop(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users...\site-packages\streamlit\runtime\app_session.py", line 533, in _handle_scriptrunner_event_on_event_loop
    self._create_new_session_message(page_script_hash)
  File "C:\Users\...\site-packages\streamlit\runtime\app_session.py", line 641, in _create_new_session_message
    imsg.environment_info.streamlit_version = STREAMLIT_VERSION_STRING
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bad argument type for built-in operation

This is not happening with version 1.22.0.

Reproducible Code Example

import streamlit as st

st.title('Welcome')

Steps To Reproduce

Go to the directory. Run the app.

Expected Behavior

There should be no error pop up window.

Current Behavior

Error message:

Bad message format Tried to use SessionInfo before it was initialized

Is this a regression?

  • [ ] Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.27.0
  • Python version: 3.11.0
  • Operating System: Win 10
  • Browser: Edge (latest version), Chrome(latest version)

Additional Information

No response

alexfilothodoros avatar Oct 13 '23 12:10 alexfilothodoros

If this issue affects you, please react with a 👍 (thumbs up emoji) to the initial post.

Your feedback helps us prioritize which bugs to investigate and address first.

Visits

github-actions[bot] avatar Oct 13 '23 12:10 github-actions[bot]

Hi @alexfilothodoros, thanks for your submission! I was unable to reproduce, but in the past users have been able to resolve this issue by upgrading their streamlit version. Could you try upgrading to latest 1.28?

mayagbarnes avatar Oct 30 '23 19:10 mayagbarnes

Hi! It looks OK now.

alexfilothodoros avatar Oct 31 '23 19:10 alexfilothodoros

@mayagbarnes, I am getting this same error with 1.30.0 and 1.31.0, but not 1.29.0. It's been an issue before, so is this regression?

deeleeramone avatar Feb 08 '24 19:02 deeleeramone

Hi. I have re-opened the issue to ease discussion. I haven't updated to the latest version yet, so I cannot confirm that this problem is back.

alexfilothodoros avatar Feb 09 '24 07:02 alexfilothodoros

I am having the same issue when deployed via Google Cloud Run using version 1.30.0. Is there an update on the fix?

vojomo-mbalick avatar Mar 05 '24 18:03 vojomo-mbalick

Hi, I have same problem with version 1.32.2, same with version 1.31.1 but when i was with version 1.29 it was fine.

lukistr avatar Apr 03 '24 22:04 lukistr

Also I have same issue with streamlit==1.33.0. For now the only way to resolve is downgrade to 1.29?

juanluishg avatar Apr 18 '24 07:04 juanluishg

downgraded to 1.29 to see if issue is gone

DaRutSki avatar Apr 30 '24 12:04 DaRutSki

Hi, I'm facing the same issue with current version 1.34.0. I'll be using 1.29.0 as well

gareia avatar May 17 '24 00:05 gareia

BTW I was using cloudrun upgraded everything to v2(cloud run) seems to help with the stability

DaRutSki avatar May 17 '24 07:05 DaRutSki

im getting this issue in 1.35.

@kmcgrady will the fix be shipped with 1.36? Is there any plan to have a patch in the meantime? thanks

lucasrodes avatar Jun 03 '24 21:06 lucasrodes

Hey @lucasrodes ! It will be shipped in 1.36. We did not plan to release a patch, mainly because it's a race condition. You are welcome to install streamlit-nightly instead, which should have the fix in. Let us know if it works.

We found this tends to activate when a user calls st.rerun quickly in the app, which finishes execution before the app started. In case that lines up with the issue you are seeing.

kmcgrady avatar Jun 03 '24 21:06 kmcgrady

thanks @kmcgrady!

I actually looked for the develop version, installed it and it is working on my end. Thanks.

lucasrodes avatar Jun 03 '24 21:06 lucasrodes