Python 2.7 EOL FAQ
Last updated May 03, 2023
Table of Contents
Why is Python 2 being sunset?
Python 2 was superseded by Python 3 many years ago, and as such the upstream Python project officially ended support for Python 2 on January 1st, 2020, after several extensions to the sunset date. This means no new versions of Python 2 are being released upstream, so it no longer receives security or bug fixes.
What Heroku stack versions support Python 2?
Python 2 is only supported on Heroku’s oldest stack, Heroku-18, which reached end-of-life on April 30th, 2023.
What will happen to existing Python 2 apps on Heroku?
Existing Python 2.7 applications on Heroku will continue to run for the foreseeable future (unless impacted by issues unrelated to the Python version).
- Since Python 2 has not received security fixes since 2020, it contains several unfixed security vulnerabilities, and so customers are strongly encouraged to migrate to a newer Python version to keep their applications secure.
- It is no longer possible to perform further builds (code deployments) of apps on Heroku-18, so Python 2 apps can no longer be updated until they are first upgraded to a newer Heroku stack (which will also require updating to Python 3). See the Heroku-18 End-of-Life FAQ for more details.
Will Python 2 apps still receive technical support?
End of life language versions fall outside of Heroku’s Support Policy, and so Python 2 applications are no longer eligible for technical support without first upgrading to a supported version of Python.
How do I migrate my application to Python 3?
See the upstream Python project’s guide to Porting Python 2 Code to Python 3.
Once your application has been made compatible with Python 3 locally, you will then need to ensure that Heroku builds your application using Python 3. See Specifying a Python Runtime and supported Python versions.
I’m not going to be able to migrate to Python 3, what are my options?
Python 2 contains several unfixed security vulnerabilities, and so customers are strongly encouraged to migrate to a newer Python version to keep their applications secure. However, if you are willing to accept this risk there are two ways you can continue to use Python 2:
- If your application does not need any further code changes/new deployments, you can continue using your existing Python 2 application even after the end-of-life of the Heroku-18 stack with no changes required (see the Heroku-18 End-of-Life FAQ for more details).
- However, if you wish to continue performing new code deployments one alternative would be to migrate to Heroku’s
containerstack instead, and use the legacy
python:2.7Docker images (note: these Docker images have not received security updates since 2020 either). See: