Skip to content

TypeError at "with elements()" on Streamlit Cloud with Python 3.13 #39

Description

@cmallagoli

Hi, I am experiencing a persistent TypeError at the with elements(...) declaration line when using the library on Streamlit Cloud. The error occurs even with a minimal reproducible example.

Environment:

  • Streamlit Cloud
  • Python 3.13
  • requirements.txt:
    streamlit==1.35.0
    streamlit-elements==0.1.0
    supabase
    pandas
    gotrue
    

Traceback:
Traceback:
File "/home/adminuser/venv/lib/python3.13/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/mount/src/dashboard/Dash.py", line 355, in

Minimal Reproducible Example:
The following code still produces the TypeError after a successful login.

import streamlit as st
from streamlit_elements import elements, dashboard, mui

st.set_page_config(layout="wide")

# Mock session state for testing
if 'auth_user' not in st.session_state:
    st.session_state['auth_user'] = True

if st.session_state.get('auth_user'):
    with st.sidebar:
        st.write("Logged In")

    # Define a simple layout for one item
    layout = [dashboard.Item("test_card", 0, 0, 6, 10)]

    st.write("Attempting to enter elements block...")

    try:
        with elements("dashboard_elements", key="dashboard_main"):
            with dashboard.Grid(layout, rowHeight=30):
                with dashboard.Item(key="test_card"):
                    with mui.Paper(sx={"padding": "15px", "backgroundColor": "#313b44"}):
                        mui.Typography("Static Test Card")
                        mui.Typography("If this appears, the basic layout works.")
        st.write("Elements block finished successfully.")
    except Exception as e:
        st.error(f"Error caught within the script: {e}")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions