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.

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