Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Can't deploy Python >= 3.8 App Engine Flex with new runtime_config

I'm struggling to change my runtime_config from

 

runtime_config:
    python_version: 3.7

 

Changing to the documented version, these values are completely ignored and the system drops down to a dockerfile for Python 2.7... with the error

Step #1: DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at....

 

runtime: python
env: flex
entrypoint: gunicorn -k eventlet -b :8080 main:app

runtime_config:
operating_system: "ubuntu22"
runtime_version: "3.10" # I've tried a few variations with and without quotes 3.8, 3.9 etc.

network:
session_affinity: true

manual_scaling:
instances: 1

resources:
cpu: .2
memory_gb: 0.5
disk_size_gb: 10

my gcloud version is

Google Cloud SDK 483.0.0
app-engine-python 1.9.113
beta 2024.06.28 bq 2.1.6
cloud-datastore-emulator 2.3.1
core 2024.06.28
gsutil 5.30

Here says you need 420.0.0 +
https://cloud.google.com/appengine/docs/flexible/python/runtime

Solved Solved
0 2 726
1 ACCEPTED SOLUTION

Hi @nodata,

I understand that you are using the latest gcloud version but based on the deprecation error you shared, it looks like it was caused by a Python/pip compatibility and dependency issue.

Replication:

I tried reproducing the behavior using the latest Python sample app and was able to deploy the app without the error. The sample app is utilizing the newest runtime_config.

Troubleshooting:

  • Ensure Python compatibility:
    Make sure your application is compatible and fully migrated to use Python 3.8 and above and you have tested it locally with this version
  • Check dependencies:
    Ensure all dependencies in your requirements.txt are compatible with Python 3.8 and above. Update any outdated or incompatible packages
  • Use latest version: Omit the runtime_version to always install the latest supported Python version on Ubuntu 22

Recommendations:

  • Use the latest Python sample app as your baseline. Refer to the detailed guide on building Python app on Google App Engine
  • Migrate (avoid using pip since 2.7 is no longer supported) / upgrade your pip3 version by using any of the 3 commands below to ensure compatibility:
    sudo python3 get-pip.py (install in root directory)
    pip3 install --upgrade pip
    python -m pip install --upgrade pip

    Note: Use pip3 --version to check the version
  • Use custom runtime for alternate implementation of any supported flexible environment language, or to customize a Google-provided one
  • Perform a full uninstall/install of your pip in case the installation is defective:

 

python -m pip uninstall pip
apt-get remove python-pip
apt-get install python-pip
pip install pip==24.1.2

 

Hope this helps.

View solution in original post

2 REPLIES 2

Hi @nodata,

I understand that you are using the latest gcloud version but based on the deprecation error you shared, it looks like it was caused by a Python/pip compatibility and dependency issue.

Replication:

I tried reproducing the behavior using the latest Python sample app and was able to deploy the app without the error. The sample app is utilizing the newest runtime_config.

Troubleshooting:

  • Ensure Python compatibility:
    Make sure your application is compatible and fully migrated to use Python 3.8 and above and you have tested it locally with this version
  • Check dependencies:
    Ensure all dependencies in your requirements.txt are compatible with Python 3.8 and above. Update any outdated or incompatible packages
  • Use latest version: Omit the runtime_version to always install the latest supported Python version on Ubuntu 22

Recommendations:

  • Use the latest Python sample app as your baseline. Refer to the detailed guide on building Python app on Google App Engine
  • Migrate (avoid using pip since 2.7 is no longer supported) / upgrade your pip3 version by using any of the 3 commands below to ensure compatibility:
    sudo python3 get-pip.py (install in root directory)
    pip3 install --upgrade pip
    python -m pip install --upgrade pip

    Note: Use pip3 --version to check the version
  • Use custom runtime for alternate implementation of any supported flexible environment language, or to customize a Google-provided one
  • Perform a full uninstall/install of your pip in case the installation is defective:

 

python -m pip uninstall pip
apt-get remove python-pip
apt-get install python-pip
pip install pip==24.1.2

 

Hope this helps.

Hi @jaydubu thanks so much for your quick reply, this sorted it.

I'm still not au fait with venv and the current python interpreter etc. having a bearing on deployment.. I'll try to make sure everything is in sync the next time I deploy or need to move beyond what I have now.