/bin/sh: 1: exec: gunicorn: not found

2.3k Views Asked by At

I am trying to deploy a simple django app on google cloud app engine. App has basic wsgi and asgi servers where wsgi is serving HTTPS requests and asgi is serving websocket requests. I am following the google app engine tutorial to deploy the app and it gets built and deployed successfully. However, it is unable to find the installed packages on deployed workspace.

These are the steps I am following

gcloud init
virtualenv myenv
source activate myenv/bin/activate
pip install -r requirements.txt
gcloud app deploy

requirements.txt do have gunicorn and daphne and they also gets installed.

This is error I get when I open the deployed app on browser.

2020-12-15 20:48:25 my-service[20201216t014451]  /bin/sh: 1: exec: gunicorn: not found

This is how my app.yaml file looks like

runtime: python38
service: my-service
instance_class: F2

entrypoint: gunicorn -b :$PORT main:app
handlers:
  - url: /.*
    script: auto
    secure: always

inbound_services:
- warmup

automatic_scaling:
  min_instances: 1
  min_idle_instances: 1
  max_instances: 2
  max_idle_instances: 1

I have also tried by passing the exact path in the entrypoint i.e entrypoint: gunicorn -b :$PORT main:app but got the same error

I am calling gcloud app deploy inside my virtualenv but when it gets deployed it is unable to read the installed packages i.e daphne and gunicorn. They both work totally fine on local environment in the same directory with same packages.

I have referred to these questions this and this and tried the answers but nothing worked.

1

There are 1 best solutions below

0
On BEST ANSWER

GAE app engine needs the requirements.txt file in the same directory as app.yaml.

My requirements.txt file was in a sub-folder, that is why google app engine was unable to install gunicorn. I was installing the requirements locally and passing the installed requirements while deploying, but it seems there is no need to install them locally ( except to test changes on local server ).