Why do I get [INFO] Worker Exiting (pid: 2) when deploying cloud run service with docker? (On VSCode with cloud code extension)

I’m really new to this stuff, I’m a 16 year old currently doing a research project/internship, and I’ve just started 2 weeks ago. So I’m extremely confused. I’ve pretty much only got to this point by brute force. Please let me know if you need any other information.

My dockerfile is

FROM python:slim

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1

# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1

# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt

WORKDIR /app
COPY . /app

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "pyaudio:app"]

When I try to open the URL provided, it says "Service not available".

The URL is: https://internship-aiffpkop5q-as.a.run.app/

The logs I’m receiving in Cloud Run Logs when I try to open the URL are:


2021-11-24T03:55:09.124682Z [1] [INFO] Listening at: http://0.0.0.0:8080 (1)

2021-11-24T03:55:09.124702Z [1] [INFO] Using worker: sync

2021-11-24T03:55:09.149832Z [2] [INFO] Booting worker with pid: 2

2021-11-24T03:55:09.157491Z [2] [ERROR] Exception in worker process

2021-11-24T03:55:09.157955Z 
Traceback (most recent call last): 
File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() 
File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() 
File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() 
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() 
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() 
File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_uri) 
File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) 
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) 
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load 
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked ModuleNotFoundError: No module named 'pyaudio'

2021-11-24T03:55:09.157964Z [2] [INFO] Worker exiting (pid: 2)

2021-11-24T03:55:09.224921Z [1] [INFO] Shutting down: Master

2021-11-24T03:55:09.225071Z [1] [INFO] Reason: Worker failed to boot.

2021-11-24T03:55:09.233682ZGET503978 B927 msChrome 95 https://internship-aiffpkop5q-as.a.run.app/

2021-11-24T03:55:09.522511ZGET5000 B0 msChrome 95 https://internship-aiffpkop5q-as.a.run.app/favicon.ico```

Source: Python Questions

LEAVE A COMMENT