Module 'streamlit' has no attribute 'dialog'

Summary

Want to have a popup modal to display status. so tried to create a test page using code copied from docs

Steps to reproduce

Code snippet:

import streamlit as st

dialog = st.dialog(
    "first_dialog", title="Introduce yourself",
    can_be_closed=True)

if st.button("Open dialog", key="first_dialog_button"):
    dialog.open()

Expected behavior:
start with a “open dialog” button. When clicked, open the “first_dialog”

Actual behavior:

2023-10-16 22:05:15.244 Uncaught app exception
Traceback (most recent call last):
  File "C:\_JIRA\Transcriber\.venv\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 541, in _run_script
    exec(code, module.__dict__)
  File "C:\_JIRA\Transcriber\dialogTest.py", line 3, in <module>
    dialog = st.dialog(
             ^^^^^^^^^
AttributeError: module 'streamlit' has no attribute 'dialog'

Debug info

  • Streamlit version: 1.27.2
  • Python version: 3.11.2
  • Using Conda? PipEnv? PyEnv? Pex? no
  • OS version: Windows 11
  • Browser version: Chrome Version 118.0.5993.71 (Official Build) (64-bit)

Requirements file

altair==4.2.2
altgraph==0.17.3
attrs==23.1.0
blinker==1.6.2
cachetools==5.3.0
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
decorator==5.1.1
entrypoints==0.4
ffmpy==0.3.0
gitdb==4.0.10
GitPython==3.1.31
greenlet==2.0.2
idna==3.4
importlib-metadata==6.6.0
Jinja2==3.1.2
jsonschema==4.17.3
markdown-it-py==2.2.0
MarkupSafe==2.1.2
mdurl==0.1.2
numpy==1.24.3
packaging==23.1
pandas==2.0.1
pefile==2023.2.7
Pillow==9.5.0
protobuf==3.20.3
pyarrow==12.0.0
pyclean==2.7.3
pydeck==0.8.1b0
Pygments==2.15.1
pyinstaller==5.10.1
pyinstaller-hooks-contrib==2023.2
Pympler==1.0.1
pyodbc==4.0.39
pyrsistent==0.19.3
python-dateutil==2.8.2
pytz==2023.3
pytz-deprecation-shim==0.1.0.post0
pywin32-ctypes==0.2.0
requests==2.30.0
rich==13.3.5
six==1.16.0
smmap==5.0.0
SQLAlchemy==2.0.12
streamlit==1.27.2
tenacity==8.2.2
toml==0.10.2
toolz==0.12.0
tornado==6.3.1
typing_extensions==4.5.0
tzdata==2023.3
tzlocal==4.3
urllib3==2.0.2
validators==0.20.0
watchdog==3.0.0
zipp==3.15.0

Hi @Steve_Liu

It seems that st.dialog is a method that is currently being developed as per the roadmap (https://roadmap.streamlit.app/), thus it is not yet released in the standard Streamlit distribution.

If you’re looking to use a popup modal, you can check out the streamlit-modal component

Hope this helps!

Hello, on the app regarding these features, st.dialog( ) and st.alert( ), the version of the app is 1.18.1, although these features seem not to exist on streamlit natively, the link of the app is the following:

Thanks @Gonzalo_Marcos

Yes, it does seem like an early prototype on the new feature by our team. Stay tuned for when it actually gets released (see the Roadmap for more detail https://roadmap.streamlit.app/)

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