0

All sorta new to using Microsoft Azure and needed help deploying a Django App to it. When I push the code from my local repo to Azure it gives me this log.

I noticed it says : The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Please see the install instructions at
https://pillow.readthedocs.io/en/latest/installation.html

I did more reading and learnt that Azure cannot install PIL or Pillow from the environment and hence needs to be installed on my system and then uploaded to Azure. I included a file called ".skipPythonDeployment" so that it doesn't erase the environment set on my local system, but then the deployment would fail again.

The important part of the Log generated while Pushing the code to Azure is attached below.

Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file. Detecting Python runtime from site configuration Detected python-2.7 Deleting incompatible virtual environment. ............................................................ Creating python-2.7 virtual environment.

Downloading/unpacking pillow (from -r requirements.txt (line 4)) .... Running setup.py (path:D:\home\site\wwwroot\env\build\pillow\setup.py) egg_info for package pillow Single threaded build for windows
warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution Downloading/unpacking Werkzeug (from -r requirements.txt (line 5)) Downloading/unpacking flask-cors (from -r requirements.txt (line 6)) Downloading Flask_Cors-3.0.2-py2.py3-none-any.whl Downloading/unpacking Flask>=0.8 (from flask-restful->-r requirements.txt (line 1)) Downloading/unpacking pytz (from flask-restful->-r requirements.txt (line 1)) Downloading/unpacking six>=1.3.0 (from flask-restful->-r requirements.txt (line 1)) Downloading six-1.10.0-py2.py3-none-any.whl Downloading/unpacking aniso8601>=0.82 (from flask-restful->-r requirements.txt (line 1)) Running setup.py (path:D:\home\site\wwwroot\env\build\aniso8601\setup.py) egg_info for package aniso8601 Downloading/unpacking olefile (from pillow->-r requirements.txt (line 4)) Running setup.py (path:D:\home\site\wwwroot\env\build\olefile\setup.py) egg_info for package olefile Downloading/unpacking itsdangerous>=0.21 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Running setup.py (path:D:\home\site\wwwroot\env\build\itsdangerous\setup.py) egg_info for package itsdangerous
warning: no previously-included files matching '' found under directory 'docs_build' Downloading/unpacking Jinja2>=2.4 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking click>=2.0 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking python-dateutil (from aniso8601>=0.82->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking MarkupSafe>=0.23 (from Jinja2>=2.4->Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading MarkupSafe-1.0.tar.gz Running setup.py (path:D:\home\site\wwwroot\env\build\MarkupSafe\setup.py) egg_info for package MarkupSafe Installing collected packages: flask-restful, numpy, pydicom, pillow, Werkzeug, flask-cors, Flask, pytz, six, aniso8601, olefile, itsdangerous, Jinja2, click, python-dateutil, MarkupSafe .................. : .................. Running setup.py install for pydicom . .. Running setup.py install for pillow Single threaded build for windows warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git*' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.
Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html

 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module>
     raise RequiredDependencyException(msg)
 __main__.RequiredDependencyException:

 The headers or library files could not be found for zlib,
 a required dependency when compiling Pillow from source.

 Please see the install instructions at:
    https://pillow.readthedocs.io/en/latest/installation.html


 Complete output from command D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools,

tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record d:\local\temp\pip-nu1mtm-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7: Single threaded build for windows running install running build running build_py creating build creating build\lib.win32-2.7 creating build\lib.win32-2.7\PIL copying PIL\BdfFontFile.py -> build\lib.win32-2.7\PIL copying PIL\BmpImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\BufrStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ContainerIO.py -> build\lib.win32-2.7\PIL copying PIL\CurImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\DcxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\DdsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\EpsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ExifTags.py -> build\lib.win32-2.7\PIL copying PIL\features.py -> build\lib.win32-2.7\PIL copying PIL\FitsStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FliImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FontFile.py -> build\lib.win32-2.7\PIL copying PIL\FpxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FtexImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GbrImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GdImageFile.py -> build\lib.win32-2.7\PIL copying PIL\GifImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GimpGradientFile.py -> build\lib.win32-2.7\PIL copying PIL\GimpPaletteFile.py -> build\lib.win32-2.7\PIL copying PIL\GribStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Hdf5StubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IcnsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IcoImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Image.py -> build\lib.win32-2.7\PIL copying PIL\ImageChops.py -> build\lib.win32-2.7\PIL copying PIL\ImageCms.py -> build\lib.win32-2.7\PIL copying PIL\ImageColor.py -> build\lib.win32-2.7\PIL copying PIL\ImageDraw.py -> build\lib.win32-2.7\PIL copying PIL\ImageDraw2.py -> build\lib.win32-2.7\PIL copying PIL\ImageEnhance.py -> build\lib.win32-2.7\PIL copying PIL\ImageFile.py -> build\lib.win32-2.7\PIL copying PIL\ImageFilter.py -> build\lib.win32-2.7\PIL copying PIL\ImageFont.py -> build\lib.win32-2.7\PIL copying PIL\ImageGrab.py -> build\lib.win32-2.7\PIL copying PIL\ImageMath.py -> build\lib.win32-2.7\PIL copying PIL\ImageMode.py -> build\lib.win32-2.7\PIL copying PIL\ImageMorph.py -> build\lib.win32-2.7\PIL copying PIL\ImageOps.py -> build\lib.win32-2.7\PIL copying PIL\ImagePalette.py -> build\lib.win32-2.7\PIL copying PIL\ImagePath.py -> build\lib.win32-2.7\PIL copying PIL\ImageQt.py -> build\lib.win32-2.7\PIL copying PIL\ImageSequence.py -> build\lib.win32-2.7\PIL copying PIL\ImageShow.py -> build\lib.win32-2.7\PIL copying PIL\ImageStat.py -> build\lib.win32-2.7\PIL copying PIL\ImageTk.py -> build\lib.win32-2.7\PIL copying PIL\ImageTransform.py -> build\lib.win32-2.7\PIL copying PIL\ImageWin.py -> build\lib.win32-2.7\PIL copying PIL\ImImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ImtImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IptcImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Jpeg2KImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\JpegImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\JpegPresets.py -> build\lib.win32-2.7\PIL copying PIL\McIdasImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MicImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MpegImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MpoImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MspImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\OleFileIO.py -> build\lib.win32-2.7\PIL copying PIL\PaletteFile.py -> build\lib.win32-2.7\PIL copying PIL\PalmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PcdImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PcfFontFile.py -> build\lib.win32-2.7\PIL copying PIL\PcxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PdfImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PixarImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PngImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PpmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PsdImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PSDraw.py -> build\lib.win32-2.7\PIL copying PIL\PyAccess.py -> build\lib.win32-2.7\PIL copying PIL\SgiImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\SpiderImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\SunImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TarIO.py -> build\lib.win32-2.7\PIL copying PIL\TgaImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TiffImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TiffTags.py -> build\lib.win32-2.7\PIL copying PIL\WalImageFile.py -> build\lib.win32-2.7\PIL copying PIL\WebPImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\WmfImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XbmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XpmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XVThumbImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL_binary.py -> build\lib.win32-2.7\PIL copying PIL_tkinter_finder.py -> build\lib.win32-2.7\PIL copying PIL_util.py -> build\lib.win32-2.7\PIL copying PIL__init__.py -> build\lib.win32-2.7\PIL running egg_info writing requirements to Pillow.egg-info\requires.txt writing Pillow.egg-info\PKG-INFO
writing top-level names to Pillow.egg-info\top_level.txt writing dependency_links to Pillow.egg-info\dependency_links.txt warning: manifest_maker: standard file '-c' not found

 reading manifest file 'Pillow.egg-info\SOURCES.txt'    reading manifest template 'MANIFEST.in'    warning: no files found matching

'.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution writing manifest file 'Pillow.egg-info\SOURCES.txt' running build_ext

 The headers or library files could not be found for zlib,    a required dependency when compiling Pillow from source.

 Please see the install instructions at:

https://pillow.readthedocs.io/en/latest/installation.html

 Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module>

 raise RequiredDependencyException(msg)    __main__.RequiredDependencyException:

 The headers or library files could not be found for zlib,    a required dependency when compiling Pillow from source.

 Please see the install instructions at:

https://pillow.readthedocs.io/en/latest/installation.html



 ----------------------------------------  Cleaning up...  ....................................................  Command

D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools, tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record d:\local\temp\pip-nu1mtm-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7 failed with error code 1 in D:\home\site\wwwroot\env\build\pillow Storing debug log for failure in D:\home\pip\pip.log An error has occurred during web site deployment. Error - Changes committed to remote repository but deployment to website failed.

Thank you

Addy
  • 348
  • 2
  • 5
  • 17

2 Answers2

2

Your pip is too old to download the whl (known issues with default version of Python). Please update your Python installation or update pip directly: https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/

Laurent Mazuel
  • 3,422
  • 13
  • 27
2

It seems that you were using Azure Web Apps/App Services for deploying your Django App which contains the Pillow package, and the Pillow package seems that you declared in the requirements.txt like Pillow>=2.0.0.

However, unfortunately, there are two issues for using the Pillow package on Azure App Services.

  1. Pillow includes C code which need to be compiled when deploying your app into Azure. The solution is that you need to build a wheel file of Pillow to add it to your project and declare the wheel file in the requirements.txt, please refer to the section Troubleshooting - Package Installation of Azure offical tutorial for Django to know it.

  2. Pillow as an image library for Python required GDI API & resources. On Azure App Services, any GDI calls are restricted and blocked, please see here to know.

So the only way for deploying your Django App is using Azure VM.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43