Packages in requirements.txt not getting installed on deploying Flask app on Azure App service

Harshita S 1 Reputation point
2021-03-04T02:40:12.777+00:00

Hello,

I followed the instuctions at https://github.com/Azure-Samples/python-docs-hello-world and deployed a basic Flask application on Azure App Service. However, if I try to install numpy and import it, there is an error. I am not sure why requirements.txt's packages aren't automatically installed.

I deployed using this command: az webapp up --sku B1 --name adaptivedialogue

Error message:

[ERROR] Exception in worker process 2021-03-03T13:39:12.563605896Z Traceback (most recent call last): 2021-03-03T13:39:12.563611996Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker 2021-03-03T13:39:12.563631096Z worker.init_process() 2021-03-03T13:39:12.563634096Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process 2021-03-03T13:39:12.563646796Z self.load_wsgi() 2021-03-03T13:39:12.563650196Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi 2021-03-03T13:39:12.563653296Z self.wsgi = self.app.wsgi() 2021-03-03T13:39:12.563656396Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi 2021-03-03T13:39:12.563665996Z self.callable = self.load() 2021-03-03T13:39:12.563669196Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load 2021-03-03T13:39:12.563672196Z return self.load_wsgiapp() 2021-03-03T13:39:12.563699696Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp 2021-03-03T13:39:12.563702996Z return util.import_app(self.app_uri) 2021-03-03T13:39:12.563706096Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app 2021-03-03T13:39:12.563709296Z mod = importlib.import_module(module) 2021-03-03T13:39:12.563712396Z File "/opt/python/3.7.9/lib/python3.7/importlib/__init__.py", line 127, in import_module 2021-03-03T13:39:12.563715496Z return _bootstrap._gcd_import(name[level:], package, level) 2021-03-03T13:39:12.563718696Z File "", line 1006, in _gcd_import 2021-03-03T13:39:12.563722096Z File "", line 983, in _find_and_load 2021-03-03T13:39:12.563725296Z File "", line 967, in _find_and_load_unlocked 2021-03-03T13:39:12.563728896Z File "", line 677, in _load_unlocked 2021-03-03T13:39:12.563732096Z File "", line 728, in exec_module 2021-03-03T13:39:12.563735296Z File "", line 219, in _call_with_frames_removed 2021-03-03T13:39:12.563738596Z File "/home/site/wwwroot/app.py", line 18, in 2021-03-03T13:39:12.563741896Z import numpy 2021-03-03T13:39:12.563744996Z ModuleNotFoundError: No module named 'numpy'

I do have numpy in my requirements.txt file, but it still says Module Not Found.

I have attached my app.py (renamed app.txt)74006-app.txt and requirements.txt files.

73988-requirements.txt73950-app.txt

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,874 questions
{count} votes