Check if your modules are up to date. If not update them using pip. Also instead of using python <filename> to run your file use to command streamlit run <filename>
python <filename>
streamlit run <filename>