Deploy on Streamlit Cloud

  1. Sign up
  2. Put your Streamlit app on GitHub
  3. Log in to share.streamlit.io
  4. Deploy your app
  5. Secrets management
  6. Share, update, and collaborate
  7. App access and usage
  8. Managing apps
  9. Limitations and known issues

To get started, first request an invite on the Streamlit Cloud Community sign-up form. Once you receive your invite email, you're ready to deploy!

  1. Add your Streamlit app to a public GitHub repo
  2. Add a requirements file for Python dependencies.
  3. (optional) Add a packages.txt file to manage any external dependencies (i.e Linux dependencies outside Python environment)
push_pin

Note

Python requirements files should be placed either in the root of your repository or in the same directory as your Streamlit app.

Streamlit looks at your requirements file's filename to determine which Python dependency manager to use in the order below. Streamlit will stop and install the first requirements file found.

FilenameDependency ManagerDocumentation
Pipfilepipenvdocs
environment.ymlcondadocs
requirements.txtpipdocs
pyproject.tomlpoetrydocs
push_pin

Note

Only include packages in your requirements file that are not distributed with a standard Python installation. If any of the modules from base Python are included in the requirements file, you will get an error when you try to deploy. Additionally, use versions 0.69.2+ of Streamlit to ensure full Streamlit Cloud functionality.

priority_high

Warning

You should only use one requirements file for your app. If you include more than one (e.g. requirements.txt and Pipfile). Streamlit will first look in the directory of your Streamlit app; however, if no requirements file is found, Streamlit will then look at the root of the repo.

If packages.txt exists in the repository we automatically detect it, parse it, and install the listed packages as described below. You can read more about apt-get in their docs.

Add apt-get dependencies to packages.txt, one package name per line. For example:

    freeglut3-dev
    libgtk2.0-dev

The first thing you'll see is a button to login with GitHub. Click on the button to login with the primary email associated with your GitHub account.

priority_high

Important

If the email you originally signed-up with isn't the primary email associated with your GitHub account, just reply to your invite email telling us your primary Github email so we can grant access to the correct account.

You can find your GitHub account email here:

Github email

Click "New app", then fill in your repo, branch, and file path, and click "Deploy".

streamlit sharing interface

If your app has a lot of dependencies it may take some time to deploy the first time. But after that, any change that does not touch your dependencies should show up immediately.

That's it — you're done! Your app can be found at:

https://share.streamlit.io/[user name]/[repo name]/[branch name]/[app path]

for example:

http://share.streamlit.io/streamlit/demo-self-driving/master/streamlit_app.py

If your app has name streamlit_app.py and your branch is master, your app is also given a shortened URL of the form https://share.streamlit.io/[user name]/[repo name]. The only time you need the full URL is when you deployed multiple apps from the same repo. So you can also reach the example URL above at the short URL http://share.streamlit.io/streamlit/demo-self-driving.

It is a bad practice to store unencrypted secrets in a git repository. Secrets management allows you to store secrets securely and access them in your Streamlit app as environment variables.

In the Streamlit Cloud deployment interface, there is a link for 'Advanced settings'. Clicking this link will bring up the secrets interface:

streamlit sharing advanced settings

Provide your secrets in the "Secrets" field using TOML format. For example:

# Everything in this section will be available as an environment variable
db_username="Jane"
db_password="12345qwerty"

# You can also add other sections if you like.
# The contents of sections as shown below will not become environment variables,
# but they'll be easily accessible from within Streamlit anyway as we show
# later in this doc.
[my_cool_secrets]
things_i_like=["Streamlit", "Python"]

Access your secrets as environment variables or by querying the st.secrets dict. For example, if you enter the secrets from the section above, the code below shows you how you can access them within your Streamlit app.

import streamlit as st

# Everything is accessible via the st.secrets dict:

st.write("DB username:", st.secrets["db_username"])
st.write("DB password:", st.secrets["db_password"])
st.write("My cool secrets:", st.secrets["my_cool_secrets"]["things_i_like"])

# And the root-level secrets are also accessible as environment variables:

import os
st.write("Has environment variables been set:",
os.environ["db_username"] == st.secrets["db_username"]
)
  1. Go to https://share.streamlit.io/
  2. Open the menu for your app and click "Edit secrets"
    streamlit sharing edit secrets
  3. Click "Save". It might take a minute for the update to be propagated to your app, but the new values will be reflected when the app re-runs.

When developing your app locally, add a file called secrets.toml in a folder called .streamlit at the root of your app repo, and copy/paste your secrets into that file.

push_pin

Note

Be sure to add this file to your .gitignore so you don't commit your secrets to your public GitHub repo!

Now that your app is deployed you can easily share it and collaborate on it. But first, let's take a moment and do a little joy dance for getting that app deployed! 🕺💃

Your app is now live at that fixed URL, so go wild and share it with whomever you want. From your deployed app you can click on the "☰" menu on the top right and select 'Share this app' to post it directly into social media or to share with the community on the Forum. We'd love to see what you make!

To help others find and play with your Streamlit app, you can add Streamlit's GitHub badge to your repo. Below is an example of what the badge looks like. Clicking on the badge takes you to, in this case, Streamlit's Face-GAN Demo.

Streamlit App

Once you deploy your app, you can embed this badge right into your GitHub README.md by adding the following Markdown:

[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/[user name]/[repo name]/[branch name]/[app path])
push_pin

Note

Be sure to replace https://share.streamlit.io/[user name]/[repo name]/[branch name]/[app path] with the URL of your deployed app!

Your GitHub repository is the source for the app, so that means that any time you push an update to your repo you'll see it reflected in the app in almost real time. Try it out!

Streamlit also smartly detects whether you touched your dependencies, in which case it will automatically do a full redeploy for you - which will take a little more time. But since most updates don't involve dependency changes, you should usually see your app update in real time.

You can collaborate with others by having multiple contributors pushing to the same GitHub repo. If you want to try out something new while still keeping your original app running, just create a new branch, make some changes, and deploy a new version of the Streamlit app.

Every deployed app has its Github source code linked in the "☰" menu on the top right. So if you are looking to understand the code of another Streamlit app, you can navigate to the GitHub page from there and read or fork the app.

Streamlit Cloud's Community tier is completely free and is meant to get you started with sharing your Streamlit apps. If you need a solution with access controls, ability to deploy from private repos, ability to customize resources, and much more, please check out the Enterprise tier.

  • Apps are visible to the entire world.
  • You can only deploy apps that are in a public GitHub repo.
  • Your source code must live in Github. We're looking to expand to other Git hosts soon.
  • Everyone with push access to your repo is automatically a maintainer of the app.

For apps without traffic for 7 consecutive days, they will automatically go to sleep. This is done to alleviate resources and allow the best communal use of the platform! Here are some need to know's about how this works:

  • As the app developer, you will receive an email after 5 days of no traffic on your app.

  • If you would like to keep your app awake, you have one of two choices:

    • Visit the app (create traffic).
    • Push a commit to the app (this can be empty!).
  • If left alone the app will go to sleep at the 7 day mark (2 days after you receive the email). When someone visits the app after this, they will see the sleeping page:

    Streamlit Share Sleeping
  • To wake the app up, press the "Yes, get this app back up!" button. This can be done by anyone who wants to view the app, not just the app developer!

  • You can also wake apps through your Streamlit Cloud dashboard. You will know which apps are sleeping because a moon icon will appear next to the app settings. To wake an app from the dashboard, click the moon.

    Sleeping Dashboard moon
  • You can deploy up to 3 apps per account.
  • Apps get up to 1 GB of RAM.
  • Apps do not have access to a GPU.
  • If you have a special good-for-the-world case that needs more resources, send us an email and we'll see about making an exception!

To view or change your deployed Streamlit apps, use your app dashboard at share.streamlit.io to view your apps, deploy a new app, delete an app, or reboot an app.

When you first log into share.streamlit.io you will land on your app dashboard, which gives you a list of all your deployed apps. This list does include apps deployed by other people who have push access to the same repos as you, since you're all managers of those apps. Such apps are indicated with an icon like this one:

Streamlit share dashboard

If your app needs a hard reboot, click on the "︙" overflow menu to the right of the app and click to Reboot. This will interrupt any user that may currently be using that app. It may also take a few minutes for your app to re-deploy, and in that time you — and anyone visiting the app — will see the 'Your app is in the oven' screen.

Reboot Streamlit share

If you're not using the app anymore, go ahead and delete it! That will free up space for you to host new apps. Click the "︙" overflow menu to the right of the app and select delete. To make sure that you do want to delete the app we ask you to type in the name of the repo to confirm that app will be deleted. Don't worry if you have multiple apps in that repo, we'll just delete the one you selected.

Delete Streamlit share app

You can see logs for your app by navigating to your app and expanding the "Manage app" button on the bottom right. That will open up a terminal view that will let you see live all the logs for your app.

Delete Streamlit share app

You can add/remove dependencies at any point by updating requirements.txt (Python deps) or packages.txt (Debian deps) and doing a git push to your remote repo. This will cause Streamlit to detect there was a change in its dependencies, which will automatically trigger its installation.

It is best practice to pin your Streamlit version in requirements.txt. Otherwise, the version may be auto-upgraded at any point without your knowledge, which could lead to undesired results (e.g. when we deprecate a feature in Streamlit).

Here are some limitations and known issues that we're actively working to resolve. If you find an issue please let us know!

  • If you're having trouble logging in, check your Streamlit Cloud invitation email and make sure you signed up using your Primary Github email, which you can find here.

  • When you print something to the terminal, you may need to do a sys.stdout.flush() before it shows up.

  • Apps execute in a Linux environment running Debian Buster (slim) with Python 3.7. There is no way to change these, and we may upgrade the environment at any point. If we do upgrade it, we will usually not touch existing apps, so they'll continue to work as expected. But if there's a critical fix in the update, we may force-upgrade all apps.

  • Matplotlib doesn't work well with threads. So if you're using Matplotlib you should wrap your code with locks as shown in the snippet below. This Matplotlib bug is more prominent when you share your app apps since you're more likely to get more concurrent users then.

    from matplotlib.backends.backend_agg import RendererAgg
    _lock = RendererAgg.lock
    
    with _lock:
      fig.title('This is a figure)')
      fig.plot([1,20,3,40])
      st.pyplot(fig)
    
  • All apps are hosted in the United States. This is currently not configurable.

Was this page helpful?

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.