DebianDebian Based

How To Install Streamlit on Debian 13

Install Streamlit on Debian 13

If you build data apps or machine learning prototypes in Python, you already know how long it takes to wire up a proper frontend. Streamlit solves that problem by letting you turn a plain Python script into a working, shareable web app in minutes, no HTML or JavaScript required. This guide walks you through the complete process to install Streamlit on Debian 13 and get a working app running on your server or desktop. Every command here was tested on a clean Debian 13 (Trixie) installation, so you can follow along with confidence.

What Is Streamlit and Why Run It on Debian 13?

Streamlit is an open-source Python library built specifically for creating interactive data applications. Unlike Flask or Django, it requires zero frontend knowledge. You write Python, and Streamlit handles the UI.

Debian 13, codenamed Trixie, was officially released on August 9, 2025. It ships with Python 3.13 out of the box, systemd 257 for robust service management, and a Linux 6.12 LTS kernel. That combination makes it one of the most stable and production-ready environments available for hosting Streamlit apps today.

Streamlit officially supports Python 3.10 through 3.14, which means the Python 3.13 included in Debian 13 is a direct compatibility match with no workarounds needed.

Common use cases include:

  • Interactive data exploration dashboards
  • Machine learning model demos and prototypes
  • Internal analytics tools for data teams
  • Rapid prototyping of Python-based data applications
  • Educational and presentation tools

Prerequisites

Before running any commands, confirm your environment meets the following requirements.

System requirements:

  • Debian 13 (Trixie) server or desktop install, either fresh or fully updated
  • Minimum 2 GB RAM (4 GB recommended for data-intensive apps)
  • At least 5 GB of free disk space
  • A non-root user account with sudo privileges
  • Active internet connection for downloading packages

Knowledge requirements:

  • Basic Linux command-line familiarity (navigating directories, editing files)
  • Basic understanding of Python and pip
  • Optional: prior experience with Python virtual environments

Step 1: Update Your Debian 13 System

Always start with a full system update. This ensures you have the latest security patches and prevents dependency conflicts during installation.

Run the following two commands:

sudo apt update
sudo apt upgrade -y

apt update refreshes the local package index from all configured repositories. apt upgrade -y installs available upgrades for installed packages, with the -y flag auto-confirming all prompts.

On Debian 13, the APT package manager uses the new deb822 format for source files under /etc/apt/sources.list.d/, which is a minor structural change from Debian 12. This does not affect how you run these commands.

Step 2: Verify Python 3.13 Is Installed

Debian 13 ships Python 3.13 natively. You do not need to compile or manually install Python. Just verify it is present:

python3 --version

Expected output:

Python 3.13.x

Next, install the pip package manager, the venv module for virtual environments, and the Python development headers:

sudo apt install -y python3-pip python3-venv python3-dev

Here is what each package does:

  • python3-pip: installs pip, which you use to install Python packages including Streamlit
  • python3-venv: provides the venv module for creating isolated Python environments
  • python3-dev: includes C header files needed to compile Python extensions some Streamlit dependencies require

Important: Do not run sudo pip install streamlit directly on the system Python. This can overwrite or corrupt system-managed packages and break other tools that depend on specific library versions.

Step 3: Install Essential Build Dependencies

Some of Streamlit’s Python dependencies include C extensions that must be compiled during installation. Without build tools, those installations fail.

Install the core build toolchain:

sudo apt install -y build-essential

The build-essential package pulls in GCC, G++, make, and the standard C library headers. These are foundational tools for compiling any software from source on a Debian system.

While you are at it, install Git. You will want it for cloning Streamlit project repositories and managing your own app’s version history:

sudo apt install -y git

Step 4: Create a Python Virtual Environment

A virtual environment is an isolated Python installation that keeps all your project’s packages separate from the system Python and from other projects. This is the recommended approach by the official Streamlit documentation and is considered best practice in Python development.

Create a Project Directory and Virtual Environment

mkdir ~/streamlit_project
cd ~/streamlit_project
python3 -m venv venv

This creates a folder called venv/ inside your project directory. It contains a private copy of the Python interpreter, pip, and an empty site-packages directory where your project’s libraries will live.

Activate the Virtual Environment

source venv/bin/activate

After running this command, your terminal prompt changes to show (venv) at the beginning. That prefix confirms you are now inside the isolated environment. Any pip install command you run from this point installs packages into this environment only, not system-wide.

Upgrade pip Inside the Virtual Environment

pip install --upgrade pip

Running the latest version of pip prevents known bugs in dependency resolution that can cause confusing installation errors with newer packages.

Deactivate When Done

When you finish working on this project, you can exit the virtual environment with:

deactivate

Your prompt returns to normal, and all subsequent Python commands use the system Python again.

Step 5: Install Streamlit on Debian 13

With the virtual environment active, install Streamlit using pip:

pip install streamlit

This command downloads Streamlit and resolves all of its required dependencies automatically, including libraries like pandas, numpy, altair, tornado, and protobuf.

The installation typically takes two to four minutes depending on your internet speed and CPU. You will see a progress bar and a list of packages being downloaded.

Install a Specific Streamlit Version (Optional)

For production environments where consistency matters, pin the version:

pip install streamlit==1.43.0

Check the current latest stable release on the official PyPI page before pinning.

Verify the Installation

Confirm Streamlit installed correctly:

streamlit --version

Expected output:

Streamlit, version 1.x.x

Now launch the built-in demo app to confirm the full installation is functional:

streamlit hello

Streamlit starts a local web server and opens your default browser to http://localhost:8501, where you will see the interactive Streamlit demo showcasing animations, charts, and widgets. If the browser does not open automatically, copy the URL from your terminal and paste it manually.

Stop the demo at any time by pressing Ctrl+C in the terminal.

Step 6: Create and Run Your First Streamlit App

Now build a minimal real app to confirm everything works end to end.

Write the App File

Create a new file called app.py:

nano app.py

Add the following code:

import streamlit as st

st.title("Hello from Debian 13!")
st.write("Streamlit is running successfully on Debian 13 (Trixie).")

name = st.text_input("Enter your name:")
if name:
    st.success(f"Welcome, {name}!")

Save and close the file with Ctrl+X, then Y, then Enter.

Run the App

streamlit run app.py

Streamlit outputs two URLs in the terminal:

  Local URL: http://localhost:8501
  Network URL: http://192.168.x.x:8501

The Local URL works from the same machine. The Network URL lets other devices on your LAN connect to the app.

Access the App in a Browser

Open your browser and navigate to http://localhost:8501. You will see the title, the text, and a text input field. Type your name and watch the success message appear in real time without any page reload.

If you are on a remote server, replace localhost with the server’s public IP address:

http://<server-ip>:8501

Step 7: Configure the Firewall to Allow Streamlit Traffic

Streamlit runs on port 8501 by default. On a server install, the UFW firewall may block incoming connections on that port.

Install UFW if it is not already present:

sudo apt install -y ufw

Allow SSH first to make sure you do not lock yourself out:

sudo ufw allow OpenSSH

Open port 8501 for Streamlit:

sudo ufw allow 8501/tcp

Enable the firewall and verify the rules:

sudo ufw enable
sudo ufw status

In the output, confirm that port 8501 shows as ALLOW. You can now reach your Streamlit app from outside the machine.

Step 8: Run Streamlit as a systemd Service

Running streamlit run directly in a terminal session means your app stops the moment you close that terminal. For any server deployment, you need the app to run persistently in the background and restart automatically after a crash or reboot.

Debian 13 ships with systemd 257, which handles this reliably.

Create a Dedicated System User

A dedicated low-privilege user adds a layer of security:

sudo adduser --system --no-create-home streamlit_user

Create the Service File

sudo nano /etc/systemd/system/streamlit.service

Paste the following content, replacing <your-user> with your actual username:

[Unit]
Description=Streamlit Application
After=network.target

[Service]
User=streamlit_user
WorkingDirectory=/home/<your-user>/streamlit_project
ExecStart=/home/<your-user>/streamlit_project/venv/bin/streamlit run app.py --server.port 8501 --server.address 0.0.0.0
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Save and close the file.

Enable and Start the Service

sudo systemctl daemon-reload
sudo systemctl enable streamlit
sudo systemctl start streamlit
sudo systemctl status streamlit

A green active (running) status in the output confirms the service is live. The enable command ensures the service starts automatically on every reboot.

Step 9: Set Up Nginx as a Reverse Proxy (Optional)

For public-facing apps, placing Nginx in front of Streamlit lets you serve traffic on standard port 80 or 443, handle HTTPS, and add an extra security layer.

Install Nginx

sudo apt install -y nginx

Configure Nginx for Streamlit

sudo nano /etc/nginx/sites-available/streamlit

Add the following server block:

server {
    listen 80;
    server_name your_domain_or_ip;

    location / {
        proxy_pass http://127.0.0.1:8501;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_http_version 1.1;
        proxy_read_timeout 86400;
    }
}

The Upgrade and Connection headers are critical. Streamlit uses WebSockets for real-time UI updates, and these headers tell Nginx to pass WebSocket connections through to the backend. Without them, the app loads but interactive widgets stop working.

Enable the Site and Restart Nginx

sudo ln -s /etc/nginx/sites-available/streamlit /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

nginx -t tests the configuration file for syntax errors before restarting. Fix any reported errors before proceeding.

For HTTPS, install Certbot and request a Let’s Encrypt certificate after pointing your domain’s DNS A record at the server.

Managing Your Streamlit Environment

Keep your project reproducible and easy to maintain with these habits.

Save your dependencies:

pip freeze > requirements.txt

Reinstall on a new machine from the saved list:

pip install -r requirements.txt

Update Streamlit to the latest version:

pip install --upgrade streamlit

Check your currently installed version:

streamlit --version

Always perform updates inside the activated virtual environment. Running pip install --upgrade streamlit outside the venv upgrades the wrong Python environment and leaves your project environment unchanged.

Troubleshooting Common Issues

Issue Likely Cause Fix
streamlit: command not found Virtual environment not active Run source venv/bin/activate, then retry
Port 8501 unreachable from browser UFW blocking the port Run sudo ufw allow 8501/tcp
pip: command not found python3-pip not installed Run sudo apt install -y python3-pip
App crashes immediately on startup Missing Python dependencies Run pip install -r requirements.txt inside the venv
systemd service fails to start Wrong path in service file Double-check WorkingDirectory and ExecStart in the .service file
ModuleNotFoundError on import Package installed outside active venv Activate venv first: source venv/bin/activate, then reinstall
Widgets not updating in browser WebSocket headers missing in Nginx Add Upgrade and Connection headers to the Nginx config

If you see an error not listed here, run the app with verbose pip output:

pip install -v streamlit

This prints detailed installation logs that identify exactly which package or dependency failed.

Congratulations! You have successfully installed Streamlit. Thanks for using this tutorial for installing Streamlit on Debian 13 “Trixie” system. For additional or useful information, we recommend you check the official Streamlit website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.
Back to top button