App dependencies
The main reason that apps fail to build properly is because Streamlit Community Cloud can't find your dependencies! So make sure you:
- Add a requirements file for Python dependencies.
- (optional) Add a
packages.txt
file to manage any external dependencies (i.e Linux dependencies outside Python environment).
Note
Python requirements files should be placed either in the root of your repository or in the same directory as your Streamlit app.
Add Python dependencies
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.
Filename | Dependency Manager | Documentation |
---|---|---|
Pipfile | pipenv | docs |
environment.yml | conda | docs |
requirements.txt | pip | docs |
pyproject.toml | poetry | docs |
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, we recommend that you use the latest version of Streamlit to ensure full Streamlit Community Cloud functionality.
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.
apt-get dependencies
If packages.txt
exists in the root directory of your 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