Supported Python Versions

Cloud Composer supports Python 2 and Python 3. Environments with different Python versions can run in the same Google Cloud Platform project.

How versioning works

You can specify the major Python version. For the major version you specify, Cloud Composer installs the latest supported major.minor.patch version. The default Python version is used if the version is unspecified.

Major version Minor-Patch version
2 (default) 2.7.15
3 3.6.6

You can see the major Python version for your environment in the environment details.

Selecting a version

When you create a new Cloud Composer environment, you can select the Python version. Once created, you cannot change an environment's Python version.

Important information about Python 2 support

Currently, Cloud Composer supports Python 2 environments. Python 2 is scheduled for end-of-life on January 1, 2020. To ensure forward compatibility, we recommend migrating your DAGs to Python 3.

How Python versions affect DAGs and dependencies

When you install Python dependencies from the Python Package Index, the environment's Python version determines which pip installs the package. For example, Python 3 uses pip3. Additionally, the pip command points to pip3.

Because the Python 3 package includes Python 2, the issue of which python interpreter to use arises (PEP 394). For Python 3 environments, the python command points to python3. Because Python 2 is scheduled for end-of-life, we recommend that you explicitly use python2 or python3 in operators, such as BashOperator and PythonOperators.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Composer