Install Streamlit using Anaconda Distribution
This page walks you through installing Streamlit locally using Anaconda Distribution. At the end, you'll build a simple "Hello world" app and run it. You can read more about Getting started with Anaconda Distribution in Anaconda's docs. If you prefer to manage your Python environments via command line, check out how to Install Streamlit using command line.
Prerequisites
-
A code editor
Anaconda Distribution includes Python and basically everything you need to get started. The only thing left for you to choose is a code editor.
Our favorite editor is VS Code, which is also what we use in all our tutorials.
-
Knowledge about environment managers
Environment managers create virtual environments to isolate Python package installations between projects. For a detailed introduction to Python environments, check out Python Virtual Environments: A Primer.
But don't worry! In this guide we'll teach you how to install and use an environment manager (Anaconda).
Install Anaconda Distribution
-
Go to anaconda.com/download.
-
Install Anaconda Distribution for your OS.
Create an environment using Anaconda Navigator
-
Open Anaconda Navigator (the graphical interface included with Anaconda Distribution).
-
You can decline signing in to Anaconda if prompted.
-
In the left menu, click "Environments".
-
At the bottom of your environments list, click "Create".
-
Enter "streamlitenv" for the name of your environment.
-
Click "Create."
Activate your environment
-
Click the green play icon (play_circle) next to your environment.
-
Click "Open Terminal."
-
A terminal will open with your environment activated. Your environment's name will appear in parentheses at the beginning of your terminal's prompt to show that it's activated.
Install Streamlit in your environment
-
In your terminal, type:
pip install streamlit
-
To validate your installation, enter:
streamlit hello
If this doesn't work, use the long-form command:
python -m streamlit hello
-
The Streamlit Hello example app will automatically open in your browser. If it doesn't, open your browser and go to the localhost address indicated in your terminal, typically
http://localhost:8501
. Play around with the app! -
Close your terminal.
Hello World
app and run it Create a
-
Open VS Code with a new project.
-
Create a Python file named
app.py
in your project folder. -
Copy the following code into
app.py
and save it.import streamlit as st st.write("Hello World")
-
Click your Python interpreter in the lower-right corner, then choose your
streamlitenv
environment from the drop-down. -
Right-click
app.py
in your file navigation and click "Open in integrated terminal". -
A terminal will open with your environment activated. Confirm this by looking for "(streamlitenv)" at the beginning of your next prompt. If it is not there, manually activate your environment with the command:
conda activate streamlitenv
-
In your terminal, type:
streamlit run app.py
If this doesn't work, use the long-form command:
python -m streamlit run app.py
-
Your app will automatically open in your browser. If it doesn't for any reason, open your browser and go to the localhost address indicated in your terminal, typically
http://localhost:8501
. -
Change
st.write
tost.title
and save your file:import streamlit as st st.title("Hello World")
-
In your browser, click "Always rerun" to instantly rerun your app whenever you save a change to your file.
-
Your app will update! Keep making changes and you will see your changes as soon as you save your file.
-
When you're done, you can stop your app with
Ctrl+C
in your terminal or just by closing your terminal.
What's next?
Read about our Basic concepts and try out more commands in your app.
Still have questions?
Our forums are full of helpful information and Streamlit experts.