Google App Engine Dockerfile error: Unable to locate package python3.8

Solution 1:

According to Google's documentation, you also need to add a Dockerfile in the same directory that contains the app.yaml file. For building Python containers, Google provides this base image:

enter image description here

The Python runtime has Python 2.7.9 and Python 3.7.2 pre-installed. You can customize the Dockerfile to install other versions or alternative interpreters if needed. You can specify whether to use Python 2 or Python 3 in your application's Dockerfile when creating the virtual environment:

Python 3

RUN venv /env -p python3.7

Python 2 (implicit)

RUN virtualenv /env

Python 2 (explicit)

RUN virtualenv /env -p python2.7

Here is some more information regarding Python Runtime, App Engine flexible environment, Python 3 Runtime Environment.

Solution 2:

In my case, I was using Ubuntu 16.04 and deadsnakes was no longer supporting Python3.8. See https://github.com/deadsnakes/issues/issues/195

I changed Docker to use FROM ubuntu:bionic and that allowed Docker to install Python3.8.