Python 2 support on Google Cloud

The Python community announced that it will sunset Python 2 on January 1, 2020, and are encouraging all developers to upgrade to Python 3 as soon as they can. In recognition that customers may need more time to migrate from Python 2 to Python 3, Google Cloud customers will be able to run Python 2 apps and use existing Python 2 client libraries after January 1, 2020.

Managed compute services, such as App Engine, will continue to provide a Python 2 runtime beyond January 1, 2020. Python 2 client libraries will continue to be available for download, but future major releases will only target Python 3.

This page provides a summary of Python 2 and 3 support across Google Cloud and will provide resources to help you migrate to Python 3. We will keep this page updated with the latest resources and information.

Python 2 support status

Google Cloud Python Client Libraries

New major versions of Python client libraries released after January 1, 2020 will not support Python 2.7. Previous major versions will remain available for download, allowing access to existing service endpoints, and will support users currently developing for Python 2.7.

If a vulnerability is detected in an old library version or in a library dependency of an old library version there is no plan to release a patch.

App Engine Python 2.7 Runtime

We are committed to providing long term support for the App Engine Python 2.7 runtime, continuing our more than decade-long history of supporting your apps as you move to the future at your own pace.

To support the Python 2.7 runtime for the long term, we will make the following changes over time:

  • Return the runtimes to their unforked, open-source states as much as possible. We had to heavily restrict and modify some of the runtimes to securely run your apps in our data centers. By making changes to how we operate the runtimes in our data centers, we can provide a secure and scalable environment for these runtimes over the long term.

  • Add full build systems that support package repositories, native component builds, and asset repositories.

For more information on the long term support of the App Engine Python 2.7 runtime, see the App Engine long term support plan)

Cloud SDK

Cloud SDK version 272.0.0 introduces beta support for Python 3.5 and newer. Older versions of Cloud SDK will be available for download, but we recommend using version 272.0.0 or newer and migrating to Python 3 as soon as possible.

Some Python tools other than the gcloud command-line tool that are shipped in the Cloud SDK still require a Python 2.7 interpreter, for details run: gcloud topic startup.

Deployment Manager templates

We expect that most Deployment Manager templates will continue to work with Python 3. If you use additional Python code with your templates, such as helper scripts or template modules, make sure that they are compatible with Python 3.

For information on what to expect during the transition from Python 2.7 to 3.x, see the Deployment Manager documentation.

Dataflow

On October 7, 2020, Dataflow will stop supporting pipelines using Python 2. Due to both the industry shift and the Apache Beam community's pledge to discontinue Python 2 support in 2020, Dataflow cannot guarantee long-term functional support or maintenance of the Python 2 offering.

You can run existing Python batch and streaming pipelines on Python 3 using the most recent Apache Beam SDK. We recommend checking that your pipeline code is compatible with Python 3 by following the Porting Python 2 Code to Python 3 documentation.

You can monitor the BEAM-1251 tracker for updates, improvements, and known issues related to Python 3 support in Apache Beam. For more information on the support status of Apache Beam 2.x SDKs, see the SDK version support status page.