AttributeError: module 'streamlit' has no attribute 'tabs'

Iā€™m having trouble making tabs in streamlit 1.12.0
Basic example:

import streamlit as st
tab1, tab2 = st.tabs([ā€˜Firstā€™, ā€˜Secondā€™])
with tab1:
st.write(ā€˜First tabā€™)
with tab2:
st.write(ā€˜Second tabā€™)

The error is, as in the subject:

AttributeError: module ā€˜streamlitā€™ has no attribute ā€˜tabsā€™

Thoughts?

HI @sslederer :wave:

You likely have multiple Streamlit installations on your machine. To confirm this is the case, display the Streamlit version within the same app:

import streamlit as st

with st.echo():
    st.write(f"streamlit version: {st.__version__}")

    tab1, tab2 = st.tabs(["First", "Second"])
    with tab1:
        st.write("First tab")
    with tab2:
        st.write("Second tab")

If you could share a screenshot of the entire app with the above code, Iā€™d wager the displayed version is not 1.12.0.

It shows 1.12.0, which is the same as I get when I put ā€œstreamlit versionā€ in the terminal

Thanks for your help!

Should I uninstall and reinstall?

I am seeing the same issue myself. My version is 1.10!

You need a more recent streamlit to use tabs.

Hi. I have the same issues. Updated the requirements.txt but still get the same error

pandas==2.1.0
numpy==1.25.1
matplotlib==3.4.3
streamlit==1.26.0
mplcursors==0.4
plotly==5.1.0

It works fine when hosted locally, but itā€™s not available when deployed on Streamlit Cloud.

Update: after changing the version, need to reboot the app. Thanks. SOLVED.