pythonvisual-studio-codeazure-web-app-serviceazure-bot-service

Application Error when deploying python EchoBot to the Azure App Service via VS Code. Module not found


I am trying to deploy a Python code based on Echo Bot from Bot Framework on Azure App Service.

It looks like it isn't installing the dependency 'aiohttp'.

I already:

I believe that I need to create a deployment script, but I don't know how.

I pasted below the startup log with some errors that may help to diagnose my problem:

2024-06-19T17:36:11.659660467Z    _____                               

2024-06-19T17:36:11.660293903Z   /  _  \ __________ _________   ____  

2024-06-19T17:36:11.660302104Z  /  /_\  \\___   /  |  \_  __ \_/ __ \ 

2024-06-19T17:36:11.660307404Z /    |    \/    /|  |  /|  | \/\  ___/ 

2024-06-19T17:36:11.660312304Z \____|__  /_____ \____/ |__|    \___  >

2024-06-19T17:36:11.660317505Z         \/      \/                  \/ 

2024-06-19T17:36:11.660321805Z A P P   S E R V I C E   O N   L I N U X

2024-06-19T17:36:11.660325905Z 

2024-06-19T17:36:11.660330205Z Documentation: http://aka.ms/webapp-linux

2024-06-19T17:36:11.660334506Z Python 3.9.18

2024-06-19T17:36:11.660338706Z Note: Any data outside '/home' is not persisted

2024-06-19T17:36:13.810554703Z Starting OpenBSD Secure Shell server: sshd.

2024-06-19T17:36:14.333770281Z Site's appCommandLine: gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP

2024-06-19T17:36:14.354694284Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'gunicorn --bind 0.0.0.0 --worker-class aiohttp.worker.GunicornWebWorker --timeout 600 app:APP'

2024-06-19T17:36:14.813647468Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'

2024-06-19T17:36:14.836126760Z Could not find operation ID in manifest. Generating an operation id...

2024-06-19T17:36:14.836167062Z Build Operation ID: 3ea9efd5-76gt-4207-98jb-b4ccb93fd

2024-06-19T17:36:15.757313818Z Oryx Version: 0.2.20240501.1, Commit: f83f88d3c, ReleaseTagName: 20240501.1

2024-06-19T17:36:15.803859894Z Writing output script to '/opt/startup/startup.sh'

2024-06-19T17:36:15.876379163Z WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.

2024-06-19T17:36:15.878094662Z WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.

2024-06-19T17:36:21.199999677Z 

2024-06-19T17:36:21.216749143Z Error: class uri 'aiohttp.worker.GunicornWebWorker' invalid or not found: 

2024-06-19T17:36:21.216757743Z 

2024-06-19T17:36:21.216762344Z [Traceback (most recent call last):

2024-06-19T17:36:21.216766944Z   File "/opt/python/3.9.18/lib/python3.9/site-packages/gunicorn/util.py", line 111, in load_class

2024-06-19T17:36:21.216771844Z     mod = importlib.import_module('.'.join(components))

2024-06-19T17:36:21.216776544Z   File "/opt/python/3.9.18/lib/python3.9/importlib/__init__.py", line 127, in import_module

2024-06-19T17:36:21.216781145Z     return _bootstrap._gcd_import(name[level:], package, level)

2024-06-19T17:36:21.216785545Z   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import

2024-06-19T17:36:21.216790645Z   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load

2024-06-19T17:36:21.216806746Z   File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked

2024-06-19T17:36:21.216811746Z   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed

2024-06-19T17:36:21.216816347Z   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import

2024-06-19T17:36:21.216820647Z   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load

2024-06-19T17:36:21.216825147Z   File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked

2024-06-19T17:36:21.216829547Z ModuleNotFoundError: No module named 'aiohttp'

2024-06-19T17:36:21.216834048Z ]

2024-06-19T17:36:21.216838248Z 

rs-app-service-98_0_9031ba9f_middleware for site rs-app-service-98 initialized successfully and is ready to serve requests.

2024-06-19T17:36:36.343Z ERROR - Container rs-app-service-98_0_9031ba9f didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.

2024-06-19T17:36:36.481Z INFO  - Stopping site rs-app-service-98 because it failed during startup.

Solution

  • The problem was that the deployment wasn't installing the libraries present on the requirements.txt file.

    I solved this by configuring GitHub continuous integration for my web app. The actions file had a step that installed all dependencies present on requirements.txt.