Table of Contents [expand]
Last updated May 13, 2025
The Heroku Platform uses the Python buildpack to build Python applications. The following shows Heroku’s behavior towards Python apps.
Auto-Detection
Heroku automatically recognizes your app as a Python app if it includes one of these files in its root directory:
requirements.txtpoetry.lockuv.lockPipfile.lock(for apps that use classic buildpacks)
Build Behavior
The Python buildpack detects which package manager your app uses based on the files included in the root directory of the app.
If you aren’t sure which package manager to use, we recommend trying uv, since it supports lockfiles, is extremely fast, and is actively maintained by a full-time team. Learn more.
If your app includes a requirements.txt file, it uses pip to install your dependencies:
$ pip install -r requirements.txt
If your app includes a poetry.lock file, it uses Poetry to install your dependencies:
$ poetry sync --only main
If your app includes a uv.lock file, it uses uv to install your dependencies:
$ uv sync --locked --no-default-groups
For apps that use classic buildpacks, if your app includes a Pipfile.lock file, it uses Pipenv to install your dependencies:
$ pipenv install --deploy
If you have auto-provisioning enabled on your account and meet these requirements, a Heroku Postgres database automatically provisions on the first deployment of your app. To learn more, see Python Database Auto-Provisioning.