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:
- You can create dashboards or data tools with very few lines of code.
- It is Python-first, so it integrates easily with pandas, matplotlib, plotly, and ML models.
- It runs locally and can be deployed online easily.
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