Failed building wheel for pycairo within deployment on azure web app

Martin Orator 20 Reputation points
2023-05-29T10:20:16.9266667+00:00

When deploying my flask app I am facing issue with system dependencies of my azure web app.

Is there any fix or step by step guidance how to handle missing system dependency on Linux app service hosting Python app?

My requirements.txt file:

blinker==1.6.2
certifi==2022.12.7
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
Flask==2.3.2
freetype-py==2.3.0
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
Pillow==9.5.0
pycairo==1.23.0
pypng==0.20220715.0
qrcode==7.4.2
reportlab==4.0.0
requests==2.29.0
rlPyCairo==0.2.0
typing_extensions==4.5.0
urllib3==1.26.15
Werkzeug==2.3.3

My app configuration:

SCM_DO_BUILD_DURING_DEPLOYMENT true

WEBSITE_DISABLE_SCM_SEPARATION true

WEBSITE_LOCAL_CACHE_OPTION Never

My app stack: Python 3.10

Facing error within deployment:

Building wheels for collected packages: pycairo\n[09:58:59+0000] Building wheel for pycairo (pyproject.toml): started\n[09:59:00+0000] Building wheel for pycairo (pyproject.toml): finished with status 'error'\n error: subprocess-exited-with-error\n \n × Building wheel for pycairo (pyproject.toml) did not run successfully.\n │ exit code: 1\n ╰─> [15 lines of output]\n running bdist_wheel\n running build\n running build_py\n creating build\n creating build/lib.linux-x86_64-cpython-310\n creating build/lib.linux-x86_64-cpython-310/cairo\n copying cairo/init.py -> build/lib.linux-x86_64-cpython-310/cairo\n copying cairo/init.pyi -> build/lib.linux-x86_64-cpython-310/cairo\n copying cairo/py.typed -> build/lib.linux-x86_64-cpython-310/cairo\n running build_ext\n Package cairo was not found in the pkg-config search path.\n Perhaps you should add the directory containing `cairo.pc'\n to the PKG_CONFIG_PATH environment variable\n No package 'cairo' found\n Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.\n [end of output]\n \n note: This error originates from a subprocess, and is likely not a problem with pip.\n ERROR: Failed building wheel for pycairo\n[09:59:00+0000] Failed to build pycairo\nERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects\n\n[notice] A new release of pip available: 22.2.2 -> 23.1.2\n[notice] To update, run: pip install --upgrade pip

This problem just started appearing recently on my running app (last week) and need urgent help to solve it. Thank you for your help.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,300 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,070 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.