Installing Streamlit Beginner
Get Streamlit up and running in under a minute. This lesson covers installation, creating your first app, and using hot reload for rapid development.
Prerequisites
- Python 3.8 or higher
- pip package manager
- A code editor (VS Code recommended)
Step 1: Install Streamlit
# Install Streamlit pip install streamlit # Verify installation streamlit --version # Run the built-in demo streamlit hello
python -m venv .venv and activate it before installing Streamlit.
Step 2: Create Your First App
import streamlit as st st.title("My First Streamlit App") st.write("Hello, world! This is my first Streamlit application.") name = st.text_input("What's your name?") if name: st.write(f"Hello, {name}! Welcome to Streamlit.")
Step 3: Run Your App
# Run the app streamlit run app.py # Output: # You can now view your Streamlit app in your browser. # Local URL: http://localhost:8501 # Network URL: http://192.168.1.100:8501
Hot Reload
Streamlit automatically detects changes to your source file and offers to re-run the app. You can configure this behavior:
- Always rerun: Click "Always rerun" in the top-right corner to auto-update on every save
- Manual rerun: Press
Rin the browser to rerun manually - CLI flag: Use
streamlit run app.py --server.runOnSave truefor auto-rerun
A More Complete Example
import streamlit as st import pandas as pd import numpy as np st.set_page_config(page_title="My App", page_icon="📊", layout="wide") st.title("Data Explorer") st.markdown("Upload a CSV file and explore your data interactively.") uploaded_file = st.file_uploader("Choose a CSV file", type="csv") if uploaded_file: df = pd.read_csv(uploaded_file) col1, col2, col3 = st.columns(3) col1.metric("Rows", df.shape[0]) col2.metric("Columns", df.shape[1]) col3.metric("Missing Values", df.isnull().sum().sum()) st.subheader("Data Preview") st.dataframe(df.head(20), use_container_width=True) st.subheader("Column Statistics") st.write(df.describe()) else: st.info("Upload a CSV file to get started.")
Streamlit Installed!
You have Streamlit running with hot reload. Next, explore the core features for building rich user interfaces.
Next: Core Features →Ready to Go Deeper?
Live instructor-led courses from our partners. Affiliate disclosure.
AI & ML Courses - 30% Off
Live instructor-led AI, machine learning, data science, and cloud courses for working professionals. Use code Limited30 at checkout.
EdurekaDataCamp - AI & Data Science
Hands-on Python, machine learning, and AI courses with interactive exercises and real projects.
DataCampedX - Top AI Courses
University-level AI courses from MIT, Harvard, Stanford. Earn certificates that employers recognize.
edX