Install Streamlit

push_pin

Note

Community Cloud now makes it easy to skip installation and start coding right in your browser with GitHub Codespaces. 🎉 Hop over to our Community Cloud Quickstart to create an account, deploy an example app, and jump right into a codespace to start editing. Return to Main concepts to learn all about how Streamlit works.

You can edit any app you've deployed on Community Cloud with GitHub Codespaces. See Edit your app with GitHub Codespaces.

  1. Prerequisites
  2. Install Streamlit on Windows
  3. Install Streamlit on macOS/Linux

Before you get started, you're going to need a few things:

Regardless of which package management tool you're using, we recommend running the commands on this page in a virtual environment. This ensures that the dependencies pulled in for Streamlit don't impact any other Python projects you're working on.

Below are a few tools you can use for environment management:

Streamlit's officially-supported environment manager on Windows is Anaconda Navigator.

If you don't have Anaconda install yet, follow the steps provided on the Anaconda installation page.

Next you'll need to set up your environment.

  1. Follow the steps provided by Anaconda to set up and manage your environment using the Anaconda Navigator.

  2. Select the "â–¶" icon next to your new environment. Then select "Open terminal":

    "Open terminal" in Anaconda Navigator
  3. In the terminal that appears, type:

    pip install streamlit
    
  4. Test that the installation worked:

    streamlit hello
    

    Streamlit's Hello app should appear in a new tab in your web browser!

  1. In Anaconda Navigator, open a terminal in your environment (see step 2 above).

  2. In the terminal that appears, use Streamlit as usual:

    streamlit run myfile.py
    

Streamlit's officially-supported package manager and environment manager for macOS and Linux are pip and venv, respectively. venv is a part of The Python Standard Library and comes bundled with your installation of Python. See instructions on how to install and use pip below.

Install pip. More details about installing pip can be found in pip's documentation.

On a macOS:

python -m ensurepip --upgrade

On Ubuntu with Python 3:

sudo apt-get install python3-pip

For other Linux distributions, see How to install PIP for Python.

On macOS, you'll need to install Xcode command line tools. They are required to compile some of Streamlit's Python dependencies during installation. To install Xcode command line tools, run:

xcode-select --install
  1. Navigate to your project folder:

    cd myproject
    
  2. Create a new virtual environment in that folder and activate that environment:

    python -m venv .venv
    

    When you run the command above, a directory called .venv will appear in myproject/. This directory is where your virtual environment and its dependencies are installed.

  3. Install Streamlit in your environment:

    pip install streamlit
    
  4. Test that the installation worked:

    streamlit hello
    

    Streamlit's Hello app should appear in a new tab in your web browser!

  1. Any time you want to use the new environment, you first need to go to your project folder (where the .venv directory lives) and run:

    source .venv/bin/activate
    
  2. Now you can use Python and Streamlit as usual:

    streamlit run myfile.py
    

    To stop the Streamlit server, press ctrl-C.

  3. When you're done using this environment, type deactivate to return to your normal shell.

Now that you've installed Streamlit, take a few minutes to read through Main concepts to understand Streamlit's data flow model.

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub