Search code examples
pythontensorflowazure-web-app-serviceazure-webapps

Unable to Deploy Tensorflow Flask Webapp to Azure


I am new to Azure so I am not sure if I am missing anything blatant. So what I want to do is deploy a Flask Webapp to Azure Web Hosting services. And whenever I try to deploy to the server (through VSCode) I get this error:

6:04:51 PM APPNAME: You should consider upgrading via the '/tmp/8d8600b701d3e8b/antenv/bin/python -m pip install --upgrade pip' command.
6:05:00 PM APPNAME: ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device: '/tmp/pip-unpacked-wheel-hd4wopaz/tensorflow/python/_pywrap_tensorflow_internal.so' -> '/tmp/8d8600b701d3e8b/antenv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so'\n\nWARNING: You are using pip version 20.1.1; however, version 20.2.3 is available.\nYou should consider upgrading via the '/tmp/8d8600b701d3e8b/antenv/bin/python -m pip install --upgrade pip' command.\n/opt/Kudu/Scripts/starter.sh oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.8 -i /tmp/8d8600b701d3e8b -p compress_virtualenv=tar-gz -p virtualenv_name=antenv --log-file /tmp/build-debug.log 
6:05:05 PM APPNAME: Deployment failed.

Is it because I ran out of space? When I looked at the web app settings on the Azure console it says that I still have a gig of storage left.

Also, here is a list of the requirements that I am using:

Flask==1.1.1
gevent
h5py==2.10.0
tensorflow==2.3.0
Werkzeug==0.16.0
opencv-python==4.2.0.34
numpy==1.18.5
pillow==7.2.0
pytest-shutil==1.7.0
tqdm==4.47.0
scipy==1.4.1
scikit-image==0.17.2
openpyxl==3.0.5
pandas==1.0

Any help is much appreciated! Many thanks.


Solution

  • For Zip file deployment on App Service the default size limit is - 2048 MB. Kindly check this document.

    I understand you have mentioned " web app settings on the Azure console", I'm not sure which App Service you are using, WebApps hosted in a free or shared App Service plan are subject to usage quotas. So, you could also review the “Disk Space” on the problematic WebApp, the disk space depends on the App Service plan you're using. From the Azure Portal > Navigate to your WebApp > and review the “Quotas’ blade.

    You may scale-up App service Plan to higher tier.

    Python on the Windows flavor of App Service is deprecated and is not recommended for use. I suggest you to deploy to App Service Linux. Python apps needs to be deployed with all the required pip modules. The App Service deployment engine (Kudu) automatically activates a virtual environment and runs pip install -r requirements.txt for you when you deploy a Git repository, or a Zip package with build processes switched on

    Also, if you downloaded the files in a ZIP file, extract the files first. For example, if you downloaded a ZIP file from GitHub, you cannot deploy that file as-is. GitHub adds additional nested directories, which do not work with App Service.