Search code examples
google-app-enginegoogle-cloud-platformpoppler

How to place the python packages to be install (using apt-get) in requirements.txt in GCP app engine


I am trying to run my app in GCP App engine. My Requirements.txt file looks like below:

pillow==5.1.0
pybase64==0.4.0
poppler-utils==0.68.0 

Poppler-utils can be installed only using sudo apt-get in GCP command line tool. How can I give it in requirements.txt so that the app installs that package alone using sudo apt-get command ?


Solution

  • The requirements.txt file is specific to pip and can only include Python packages.

    If you need to install an OS-level package (with apt-get), you'll need to use the Docker based App Engine Flexible environment (Standard doesn't provide this functionality) and create a custom runtime.

    You can find a Dockerfile example here extending the default python image:

    FROM gcr.io/google-appengine/python
    

    You'll then need to add the poppler-utils package via:

    RUN apt-get install poppler-utils
    

    You'll find more information about building custom runtimes for App Engine Flexible here.