GoogleCloudPlatform / generative-ai

Sample code and notebooks for Generative AI on Google Cloud, with Gemini on Vertex AI
https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview
Apache License 2.0
6.97k stars 1.88k forks source link

gunicorn failure on cloud run example #198

Open guilhem-martin opened 1 year ago

guilhem-martin commented 1 year ago

Hello,

I'm running the search webapp following the readme. The cloud run is successfully built but raises errors when deployed:

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker worker.init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 95, in init_process super().init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi()

The cloud run web page displays "service not available".

I tried several verion of gunicorn through the Dockerfile, but it didn't help.

Any idea? Thanks.

ChunKinPS commented 1 year ago

Same here, finding solution as well

guilhem-martin commented 1 year ago

@ChunKinPS What I just tried: gunicorn==21.2.0 in the requirements.txt and still 3.11 for python in the Dockerfile. But still getting the same error.

ChunKinPS commented 1 year ago

@guilhem-martin I had solved the issue. Simply remove the version for all the dependencies in requirements.txt . For my case, it solved the issue.

adityaworkfusion commented 1 year ago

I am also getting same issue with gunicorn. Basically I have deployed a python gen app on google cloud run with gunicorn version "20.1.0" but its giving me same error as above user are facing. Though with the same gunicorn version I was able to run it earlier on cloud run, please suggest me how I can fix this issue.

below is the error

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker worker.init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 95, in init_process super().init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi()

ChunKinPS commented 1 year ago

I am also getting same issue with gunicorn. Basically I have deployed a python gen app on google cloud run with gunicorn version "20.1.0" but its giving me same error as above user are facing. Though with the same gunicorn version I was able to run it earlier on cloud run, please suggest me how I can fix this issue.

below is the error

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker worker.init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 95, in init_process super().init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi()

Did u try remove the version in requirements.txt? after I remove the version, I deploy again and the issue solved. I think this is because the version of python and gunicorn causing this issue. There is some conflict over there. I am using python:3.11-slim in my dockerfile as well like you. image

adityaworkfusion commented 1 year ago

Thanks, I will try without passing any version, but what's the fix when I have version dependencies for few libraries.

ChunKinPS commented 1 year ago

One possible solution is keep trying for different version until you did not see the error, but it is not the best way to fix this.

hugomiura commented 12 months ago

I got the same error. I also removed all versions from requirements but it nothing changed.

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker worker.init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/gthread.py", line 95, in init_process super().init_process() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() File "/usr/local/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi()

holtskinner commented 10 months ago

@guilhem-martin https://github.com/GoogleCloudPlatform/generative-ai/blob/main/search/web-app/requirements.txt doesn't have a version for gunicorn or any other library except google-cloud-discoveryengine>=0.11.1.

Have you also set the PROJECT_ID and other config variables to your own values?

And setup a Vertex AI Search app in the project?