Search code examples
python-3.xdockergoogle-app-engine

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


I am using this Dockerfile to deploy to App Engine Flexible environment.

FROM gcr.io/google-appengine/python 
RUN apt-get -y update && apt-get -y upgrade\
    && apt-get install -y software-properties-common \
    && add-apt-repository -y ppa:ubuntugis/ppa \
    && add-apt-repository -y ppa:deadsnakes/ppa \
    && apt-get -y update && apt-get -y upgrade\
    && apt-get -y install python3.8 python3.8-distutils python3.8-venv \
       gdal-bin libgdal-dev python3-gdal  \
    && apt-get autoremove -y \
    && apt-get autoclean -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN virtualenv /env -p python3.8
ENV VIRTUAL_ENV /env
ENV PATH /env/bin:$PATH
ADD requirements.txt /app/requirements.txt
RUN pip install -r /app/requirements.txt
...

I've been using this configuration for at least a year and deploy to GCP regularly. As of this morning, when I try to deploy I'm getting these errors:

Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3.8
E: Couldn't find any package by glob 'python3.8'
E: Couldn't find any package by regex 'python3.8'
E: Unable to locate package python3.8-distutils
E: Couldn't find any package by glob 'python3.8-distutils'
E: Couldn't find any package by regex 'python3.8-distutils'
E: Unable to locate package python3.8-venv
E: Couldn't find any package by glob 'python3.8-venv'
E: Couldn't find any package by regex 'python3.8-venv'
The command '/bin/sh -c apt-get -y update && apt-get -y upgrade
&& apt-get install -y software-properties-common     
&& add-apt-repository -y ppa:ubuntugis/ppa     
&& add-apt-repository -y ppa:deadsnakes/ppa     
&& apt-get -y update 
&& apt-get -y upgrade    
&& apt-get -y install python3.8 python3.8-distutils python3.8-venv        gdal-bin libgdal-dev python3-gdal      
&& apt-get autoremove -y     
&& apt-get autoclean -y     
&& apt-get clean     
&& rm -rf /var/lib/apt/lists/*' returned a non-zero code: 100
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 100

I'm not sure I want to change my Python version, since some of the packages use Python3.8.

Thanks in advance for any help you can provide.


Solution

  • 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.