sample-app-aoai-chatGPT icon indicating copy to clipboard operation
sample-app-aoai-chatGPT copied to clipboard

"No module named gunicorn" still shows up

Open chindaku9531 opened this issue 11 months ago • 9 comments

Describe the bug "No module named gunicorn" showed up and I failed to start the webapp.

To Reproduce 1.Make some changes to the code(just to the frontend) and build the app code with start.cmd 2.Deploy the app with the Azure CLI https://github.com/microsoft/sample-app-aoai-chatGPT?tab=readme-ov-file#deploy-with-the-azure-cli 3.Try to start the app. 4.An error occurred.":( Application Error If you are the application administrator, you can access the diagnostic resources."

Expected behavior The Web app should be started successfully.

Screenshots image

Configuration

  • Azure OpenAI model name and version : gpt-4 0613
  • Is chat history enabled? : No
  • Are you using data? If so, what data source? (e.g. Azure AI Search, Azure CosmosDB Mongo vCore, etc): No

Additional context What I have tried 1.Deploy with the latest code(the problem "no module named gunicorn" should has been fixed by adding gunicorn to the requirements.txt file) https://github.com/microsoft/sample-app-aoai-chatGPT/issues/600

2.Make some changes to the gunicorn.conf.py and WebApp.DockerFile https://github.com/microsoft/sample-app-aoai-chatGPT/issues/600

3.Set the startup command "python3 -m gunicorn app:app" https://github.com/microsoft/sample-app-aoai-chatGPT/issues/578

4.Add the environment variable "WEBSITES_PORT=8000"

App Service Log Stream 2024-03-21T07:59:52.284529213Z A P P S E R V I C E O N L I N U X 2024-03-21T07:59:52.284533213Z 2024-03-21T07:59:52.284537114Z Documentation: http://aka.ms/webapp-linux 2024-03-21T07:59:52.284541214Z Python 3.11.7 2024-03-21T07:59:52.284545114Z Note: Any data outside '/home' is not persisted 2024-03-21T08:00:10.355872681Z Starting OpenBSD Secure Shell server: sshd. 2024-03-21T08:00:11.714511413Z Site's appCommandLine: python3 -m gunicorn app:app 2024-03-21T08:00:11.782133591Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'python3 -m gunicorn app:app' 2024-03-21T08:00:12.507301389Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it... 2024-03-21T08:00:12.518582469Z Build Operation ID: 71f84425d7bc56df 2024-03-21T08:00:12.526280360Z Oryx Version: 0.2.20240127.1, Commit: 4b7f2dffcc69c214f9806d67a85ec8926e2393e1, ReleaseTagName: 20240127.1 2024-03-21T08:00:12.575072371Z Output is compressed. Extracting it... 2024-03-21T08:00:12.575108972Z Extracting '/home/site/wwwroot/output.tar.gz' to directory '/tmp/8dc4976a9651c79'... 2024-03-21T08:00:37.071489713Z App path is set to '/tmp/8dc4976a9651c79' 2024-03-21T08:00:43.135453051Z Writing output script to '/opt/startup/startup.sh' 2024-03-21T08:00:45.075816580Z Using packages from virtual environment antenv located at /tmp/8dc4976a9651c79/antenv. 2024-03-21T08:00:45.075854381Z Updated PYTHONPATH to '/opt/startup/app_logs:/tmp/8dc4976a9651c79/antenv/lib/python3.11/site-packages' 2024-03-21T08:00:45.334222700Z /tmp/8dc4976a9651c79/antenv/bin/python3: No module named gunicorn s-openaiwebapp2__33a4 2024-03-21T08:00:34.010Z INFO - Waiting for response to warmup request for container csk-azops-openaiwebapp2__33a4_0_e0064a1c. Elapsed time = 17.0226611 sec 2024-03-21T08:00:45.778Z ERROR - Container csk-azops-openaiwebapp2__33a4_0_e0064a1c for site csk-azops-openaiwebapp2__33a4 has exited, failing site start 2024-03-21T08:00:45.779Z INFO - Initiating warmup request to container csk-azops-openaiwebapp2__33a4_0_e0064a1c_middleware for site csk-azops-openaiwebapp2__33a4 2024-03-21T08:00:46.891Z INFO - Container csk-azops-openaiwebapp2__33a4_0_e0064a1c_middleware for site csk-azops-openaiwebapp2__33a4 initialized successfully and is ready to serve requests. 2024-03-21T08:00:46.912Z ERROR - Container csk-azops-openaiwebapp2__33a4_0_e0064a1c didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging. 2024-03-21T08:00:46.950Z INFO - Stopping site csk-azops-openaiwebapp2__33a4 because it failed during startup.

chindaku9531 avatar Mar 21 '24 08:03 chindaku9531

I am facing the same issue, any recommendations?

rochaktarika123 avatar Mar 26 '24 17:03 rochaktarika123

Hi @rochaktarika123 @chindaku9531 you need to set the startup command on the app. And make sure the port you set matches in the env variable and gunicorn.conf.py

az webapp config set --startup-file "python3 -m gunicorn app:app" --name <new-app-name>

sarah-widder avatar Mar 26 '24 18:03 sarah-widder

Hi @sarah-widder Thank you for your reply. Actually I have set the startup command and tried making changes to gunicorn.conf.py like this: bind = "0.0.0.80", but this error still shows up.

Hi @rochaktarika123 How about your situation?

chindaku9531 avatar Mar 27 '24 11:03 chindaku9531

Hi @chindaku9531,

My problem is resolved just by using python 3.11 in azure webapp :)

mmdmirh avatar Mar 27 '24 22:03 mmdmirh

Hi @chindaku9531 - I tried multiple things but finally what worked was modifying the statup command as below. Hope it works for you as well

python3 -m gunicorn -k uvicorn.workers.UvicornWorker app:app

rochaktarika123 avatar Apr 03 '24 03:04 rochaktarika123

I am facing same issue 2024-04-16T13:35:29 Welcome, you are now connected to log-streaming service.Starting Log Tail -n 10 of existing logs ----/home/LogFiles/__lastCheckTime.txt (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/__lastCheckTime.txt)04/16/2024 13:34:09 /home/LogFiles/kudu/trace/01e4b68d2ef844fea5194542007a89c5-dbbadcee-b89a-4a94-bd47-62979135bf7b.txt (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/01e4b68d2ef844fea5194542007a89c5-dbbadcee-b89a-4a94-bd47-62979135bf7b.txt) 2024-04-16T13:23:32 Startup Request, url: /api/zipdeploy?isAsync=true, method: POST, type: request, pid: 86,1,7, ScmType: None/home/LogFiles/kudu/trace/94af43c0f2fa4c0995d5140091fa213c-0894961d-5ff4-469b-a18b-093ca8a0bc7f.txt (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/94af43c0f2fa4c0995d5140091fa213c-0894961d-5ff4-469b-a18b-093ca8a0bc7f.txt) 2024-04-16T13:11:48 Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 87,1,7, ScmType: None/home/LogFiles/kudu/trace/c44312df76654affba89fc8047793caa-e6ae8b1a-7f3c-4848-9b98-c5a77c9306db.txt (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/c44312df76654affba89fc8047793caa-e6ae8b1a-7f3c-4848-9b98-c5a77c9306db.txt) 2024-04-16T13:07:03 Startup Request, url: /api/deployments/?$orderby=ReceivedTime%20desc&$top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,5, ScmType: None/home/LogFiles/kudu/trace/de0cda65bb40-d949e7e3-12a7-4043-a21d-bdc5cf5b1956.txt (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/de0cda65bb40-d949e7e3-12a7-4043-a21d-bdc5cf5b1956.txt) 2024-04-16T13:34:03 Startup Request, url: /api/deployments/?%24orderby=ReceivedTime%20desc&%24top=20&api-version=2022-03-01, method: GET, type: request, pid: 86,1,7, ScmType: None/home/LogFiles/2024_04_16_lw1sdlwk0001VG_default_docker.log (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/2024_04_16_lw1sdlwk0001VG_default_docker.log) 2024-04-16T13:34:16.453722213Z File "", line 1027, in _find_and_load 2024-04-16T13:34:16.453726914Z File "", line 992, in _find_and_load_unlocked 2024-04-16T13:34:16.453744915Z File "", line 241, in _call_with_frames_removed 2024-04-16T13:34:16.453749815Z File "", line 1050, in _gcd_import 2024-04-16T13:34:16.453754415Z File "", line 1027, in _find_and_load 2024-04-16T13:34:16.453759715Z File "", line 1004, in _find_and_load_unlocked 2024-04-16T13:34:16.454111933Z ModuleNotFoundError: No module named 'uvicorn' 2024-04-16T13:34:16.454118134Z ] 2024-04-16T13:34:16.464075639Z /home/LogFiles/2024_04_16_lw1sdlwk0001VG_docker.log (https://qatarbotshell.scm.azurewebsites.net/api/vfs/LogFiles/2024_04_16_lw1sdlwk0001VG_docker.log) 2024-04-16T13:34:10.578Z INFO - Status: Downloaded newer image for 10.1.0.6:13209/appsvc/python:3.10_20240207.3.tuxprod 2024-04-16T13:34:10.597Z INFO - Pull Image successful, Time taken: 0 Seconds 2024-04-16T13:34:10.809Z INFO - Starting container for site 2024-04-16T13:34:10.810Z INFO - docker run -d --expose=8000 --name qatarbotshell_0_13a23e33 -e WEBSITE_USE_DIAGNOSTIC_SERVER=false -e WEBSITE_SITE_NAME=qatarbotshell -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=qatarbotshell.azurewebsites.net -e WEBSITE_INSTANCE_ID=ec75ffac14f5a3cf139396184c4a565cf164999cdee10579f254283ef7d9d529 appsvc/python:3.10_20240207.3.tuxprod python3 -m gunicorn -k uvicorn.workers.UvicornWorker app:app 2024-04-16T13:34:10.811Z INFO - Logging is not enabled for this container.Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here. 2024-04-16T13:34:14.578Z INFO - Initiating warmup request to container qatarbotshell_0_13a23e33 for site qatarbotshell 2024-04-16T13:34:16.922Z ERROR - Container qatarbotshell_0_13a23e33 for site qatarbotshell has exited, failing site start 2024-04-16T13:34:16.928Z ERROR - Container qatarbotshell_0_13a23e33 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging. 2024-04-16T13:34:16.986Z INFO - Stopping site qatarbotshell because it failed during startup.Ending Log Tail of existing logs

I added this python3 -m gunicorn -k uvicorn.workers.UvicornWorker app:app but it still didn't work.

kagoolastha23 avatar Apr 16 '24 13:04 kagoolastha23

Screenshot 1403-01-29 at 5 54 04 in the afternoon @kagoolastha23 here is the config i used in Azure portal and works fine for me

mmdmirh avatar Apr 17 '24 14:04 mmdmirh

I had the same issue. After deleting everything from kudu (rm -rf using bash) and redeploying using VScode with remote build configured it worked. I could not find the actual cause though.

DOliana avatar Jun 10 '24 15:06 DOliana

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 11 '24 01:08 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 25 '24 02:08 github-actions[bot]