Streamlit - Complete Setup Guide

Last Updated : 23 Feb, 2026

Streamlit is an open-source Python framework that allows you to create interactive web apps for data science and machine learning with minimal code. It works seamlessly with popular Python libraries like NumPy, Pandas, Matplotlib, scikit-learn, Keras, PyTorch and LaTeX.

Set Up a Virtual Environment

To install and run Streamlit safely, use a virtual environment. This keeps Streamlit and its dependencies separate from other Python projects. Open your terminal or command prompt and run:

python -m venv venv

This creates a virtual environment named 'venv'. You can change the name if you like.

Activate the Virtual Environment

Windows: venv\Scripts\activate
Mac/Linux: source venv/bin/activate

Install Streamlit

To install Streamlit, first make sure your virtual environment is active. Then, open your terminal and run:

pip install streamlit

Installing streamlit

Verify Installation

To confirm that Streamlit is installed correctly, run:

streamlit hello

Testing installation

Check the Streamlit Version

1. Using Terminal: Open the terminal and write the command in your terminal:

streamlit --version

This command should tell you what version the installed streamlit package is.

Checking version of Streamlit via terminal

2. Using pip: the following pip command gives all the detail of current versions of python modules which you installed in your system.

pip freeze

Checking version of Streamlit via pip

Update Streamlit Version

If you want to update your Streamlit version you can use any one of these commands.

python -m pip install --upgrade Streamlit

or

python -m pip install -U Streamlit

Updating Streamlit version

Basic Streamlit Functions

1. Adding a Title 

Python
import streamlit as st
st.title("Geeks for Geeks")

Output 

2. Adding some text 

Python
import streamlit as st
st.title("Geeks for Geeks")
st.write("A Computer Science portal for Geeks")

Output

Creating a Simple Streamlit App

Create a Python file named myFirstStreamlitApp.py and add the following code:

Python
import streamlit as st

st.title("Hello")
st.write("Hello World!")

Run the app:

streamlit run myFirstStreamlitApp.py

The app will open in your browser. Press Ctrl + C in the terminal to stop it. Your first Streamlit app will display “Hello” as the title and “Hello World!” as text.

Advantages of Streamlit

  • It embraces python-scripting. 
  • Less code is needed to create amazing web-apps. 
  • No callbacks are needed since widgets are treated as variables. 
  • Data caching simplifies and speeds up computation pipelines
Comment