question

90352266 avatar image
0 Votes"
90352266 asked ·

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

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-webapps-content-deployment
app.txt (497 B)
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Thanks for asking question! Just to confirm if you have added the setting SCM_DO_BUILD_DURING_DEPLOYMENT=true when deploying your application. This ensures that our project is built, once pushed to Azure. You'll need to go to App Service -> Configuration -> Application Settings -> New Application Setting and add it there.

Source: Enable/disable build actions (Configurable settings)
https://github.com/projectkudu/kudu/wiki/Configurable-settings#enabledisable-build-actions

Let us know if further query or issue remains.

0 Votes 0 ·

Just checking in to see if have chance to see below response. If you have any further query do let us know.

0 Votes 0 ·

0 Answers