Heroku is a platform that enables you to deploy your web application in a quick and painless manner; unless you’re stumbling upon a ‘Push rejected’ error with next to no hint how to resolve it.

Problem description

I stumbled upon this when trying to deploy a flask app but I’m pretty sure this will also happen with django apps. Here’s what happened: When deploying to Heroku you first have to initialize a git repository. For Python apps in particular, you also have to provide a requirements.txt that consists of the dependencies of your application. This is pretty standard. What was new to me is that you also have to provide a runtime.txt that tells Heroku which Python version your app was written in. As naive as I was, I merely checked for the Python version in my Anaconda environment and put python-3.7.4 in the file, committed and pushed to Heroku via git push heroku master. Here’s what I got back:

remote: Compressing source files... done.
remote: Building source:
remote: -----> Python app detected
remote:  !     Python has released a security update! Please consider upgrading to python-3.7.3
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.7.4
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote:  !     Push rejected, failed to compile Python app.
remote:  !     Push failed
An example of a non-helpful build log on heroku.com
An example of a non-helpful build log on heroku.com

That was not helpful at all. Especially the hint at upgrading to python-3.7.3 was confusing me because my proposed runtime was even more recent! The build log did not reveal anything new either.


After being confused for about half an hour, suspecting that Heroku could not cope with my requirements at first, I finally found out that Heroku does not support python-3.7.4 as a runtime! In fact, Heroku only supports three specific python runtimes at the moment. Thus, the solution is to simply use python-3.7.3 as a runtime.

Leave a comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.