Streamlit Installation

Streamlit is a Python framework that lets you turn your scripts or data analysis notebooks into interactive web apps — without needing HTML, CSS, or JavaScript.

It is popular because:

Install Streamlit using pip

Use the following command to install Streamlit:

bash

pip install streamlit    

Check Streamlit Version

bash

streamlit version    

Example output:

Output

Streamlit, version 1.48.1    

How to Upgrade pip

If you want to upgrade pip, run the following command:

bash

pip install --upgrade pip    

Execute a Streamlit Project

To run a Streamlit project, use the following command in the terminal:

bash

streamlit run your_script.py    

Example: Create a Streamlit App

Create a file named app.py:

Python

import streamlit as st

st.title("Hello Streamlit!")
st.write("This is my first web app.")

name = st.text_input("Enter your name:")

if st.button("Say Hello"):
    st.write(f"Hello, {name}!")    

Run the app using:

bash

streamlit run app.py    

Stop the app using Ctrl + C in the terminal.

Install from requirements.txt

If your requirements.txt file contains a list of packages (for example: streamlit==1.36.0), run:

bash

pip install -r requirements.txt