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

Hi, I am new to Streamlit and I am trying to build a conversational app using this tutorial :
However, I am getting this error : AttributeError: module 'streamlit' has no attribute 'chat_input'
I have removed all the other code and this is the only code I have :

import streamlit as st

prompt = st.chat_input("Say something")
if prompt:
    st.write(f"User has sent the following prompt: {prompt}")

My streamlit version is 1.23.1

Your streamlit is too old.

pip install --upgrade streamlit

doing this does not upgrade to 1.24.0. What can I do?

I uninstalled and re-installed streamlit using

pip install streamlit==1.24.0

However, there seems to be some sort of discrepancy.
pip list shows the version of streamlit as 1.24.0, but the command streamlit --version shows

Streamlit, version 1.23.1

You are running pip and streamlit in different environments.

Update the Streamlit version, i am getting same error, once i updated streamlit version its working…version 1.24.0

i’m in the base environment.

Try this:

python -m pip install streamlit==1.24.0
python -m streamlit --version

Doing this and then doing

python -m streamlit run

runs the app nicely. Thank you @Goyo ! Could you please tell me why this happens?

Because of different environments. I mean environments in a broad sense. You can have several python virtual environments, conda environments, python versions, etc. and combinations of them.

So pip was running in an environment and streamlit in a different one, but there is no way I can know the exact reason. By running both commands consecutively with a specific python you make sure you are always using the same environment.

1 Like

Thank you so much @Goyo !

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