Streamlit is an open-source Python framework that enables developers and data scientists to build interactive, web-based applications with minimal effort. Designed for simplicity and speed, Streamlit allows you to create dashboards and data apps using pure Python—no front-end development required.
Whether you're working in machine learning, data science, or analytics, Streamlit offers a streamlined way to present your data and models in real-time through powerful visual interfaces.
This guide walks you through the complete installation and setup process for Streamlit on Windows, macOS, or Linux, getting you up and running in just a few minutes.
Before we dive into the installation steps, let’s understand why Streamlit is a preferred choice among data professionals:
✅ Easy to use – Built for Python users; no need for HTML, CSS, or JavaScript.
🚀 Rapid prototyping – Create and deploy apps in minutes.
🧩 Interactive widgets – Add sliders, buttons, and input forms with one line of code.
🔄 Real-time feedback – See changes as you modify your code.
🔗 Seamless integration – Works with Pandas, NumPy, Matplotlib, Plotly, and more.
Before installing Streamlit, make sure you have the following:
✅ Python 3.7 or above
✅ pip installed (Python’s package manager)
✅ Access to a command-line interface (Terminal, Command Prompt, or PowerShell)
Open your terminal or command prompt and type:
bash
CopyEdit
python --version
If Python is installed, you’ll see the version number. Otherwise, download Python here.
Next, check if pip is available:
bash
CopyEdit
pip --version
Creating a virtual environment keeps your project dependencies isolated.
On Windows:
bash
CopyEdit
python -m venv streamlit-env
streamlit-env\Scripts\activate
On macOS/Linux:
bash
CopyEdit
python3 -m venv streamlit-env
source streamlit-env/bin/activate
Your command prompt will change to show the virtual environment is active.
With the virtual environment activated, run:
bash
CopyEdit
pip install streamlit
To confirm installation:
bash
CopyEdit
streamlit --version
Create a file named app.py.
Add the following code:
python
CopyEdit
import streamlit as st
st.title("Hello, Streamlit!")
st.write("Welcome to your first Streamlit app.")
Run the app:
bash
CopyEdit
streamlit run app.py
A new browser window will open at http://localhost:8501, displaying your app.
This usually means Streamlit isn’t installed in your active environment.
Fix: Activate your virtual environment and reinstall:
bash
CopyEdit
pip install streamlit
Occurs when trying to run a script without activating the correct environment.
Fix: Make sure your virtual environment is active before running your app.
🛠 Use virtual environments for each project to manage dependencies.
📁 Structure your project: separate data files, scripts, and assets.
⬆ Regularly update Streamlit:
bash
CopyEdit
pip install --upgrade streamlit
☁ Deploy your app online using Streamlit Community Cloud, Render, or Heroku.
Enhance your app by adding widgets like sliders and text inputs:
python
CopyEdit
import streamlit as st
st.title("Interactive Widgets Example")
name = st.text_input("Enter your name:")
age = st.slider("Select your age", 1, 100)
st.write(f"Hello, {name}! You are {age} years old.")
Hello, John! You are 30 years old.
Widgets make your apps dynamic and user-friendly with minimal code.
Streamlit is a powerful and intuitive tool that brings your Python scripts to life as interactive web applications—no front-end code required. Its simplicity, speed, and integration with popular Python libraries make it the ideal choice for building dashboards, data visualizations, and ML model demos.
Now that you’ve set up Streamlit, you’re ready to build and share your first app. Start transforming your Python code into powerful user-facing tools today!
Unlock the power of data apps with AccentFuture’s Streamlit Online Training Course– a hands-on course designed to turn your Python scripts into interactive web applications. Learn from experts and build real-world projects, all from the comfort of your home.
📧 Email: contact@accentfuture.com
📞 Call/WhatsApp: +91-9640001789
🌐 Website: www.accentfuture.com