Reputation: 1
I am trying to deploy on Azure web apps, I am getting an error around pycairo, I have tried using containers to work around that , containers are not working and even worse they don't show what the problem is. So I have reverted to Azure Web apps cause atleast I can tell the issue from the logs.
In detail the error looks like:
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 is available: 23.0.1 -> 23.3.2\n[notice] To
The web app runs smooth on my local computer, the problem comes on deployment. Whats even worse is even If I uninstall pycairo, the error will persist. Almost like there is no way around it. I have long engaged microsoft Azure support team for days now but there is no solution from their side. And thats why I am appealing to you my coding super heros, to finally end my struggle, this problem has literally stolen a week of my time and afteer spending a long time.
The stack used is Django and postgres
Deploying on Azure using both Web Apps and containers service.
I have changed python versions, I have uninstalled Pycairo, I have tried using docker containers instead. I have contacted microsoft team and hoped on troubleshooting calls.
Upvotes: 0
Views: 164
Reputation: 8639
I was facing the same issue while deploying the python web application with Pycairo package to Azure App Service.
I used the command sudo apt install libcairo2-dev pkg-config python3-dev
to resolve the issue.
(https://<webappname>.scm.azurewebsites.net)
=>SSH, run the below commands:1. apt install sudo -y //(optional as it is to install sudo)
2. sudo apt install libcairo2-dev pkg-config python3-dev
requirements.txt:
pycairo
test.py:
import os
import cairo
WIDTH, HEIGHT = 256, 256
sfc = cairo.ImageSurface(cairo.Format.ARGB32, WIDTH, HEIGHT)
ctx = cairo.Context(sfc)
ctx.set_source_rgb(0.8, 1, 1)
ctx.rectangle(0, 0, WIDTH, HEIGHT)
ctx.fill()
ctx.set_source_rgb(0.3, 0.4, 0.6)
ctx.rectangle(20, 20, 120, 80)
ctx.fill()
output_filename = 'hello_world.png'
sfc.write_to_png(output_filename)
os.system(output_filename)
3:40:53 PM pycairoapp: Starting deployment...
3:40:53 PM pycairoapp: Creating zip package...
3:41:17 PM pycairoapp: Zip package size: 12.9 MB
3:41:14 PM pycairoapp: Fetching changes.
3:41:15 PM pycairoapp: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/9eaa1ae4-7b40-4c8b-b08a-024a52af8e13.zip (12.54 MB) to /tmp/zipdeploy/extracted
3:41:18 PM pycairoapp: Updating submodules.
3:41:19 PM pycairoapp: Preparing deployment for commit id 'a113b5c6-d'.
3:41:19 PM pycairoapp: PreDeployment: context.CleanOutputPath False
3:41:19 PM pycairoapp: PreDeployment: context.OutputPath /home/site/wwwroot
3:41:19 PM pycairoapp: Repository path is /tmp/zipdeploy/extracted
3:41:19 PM pycairoapp: Running oryx build...
3:41:19 PM pycairoapp: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9 -p virtualenv_name=antenv --log-file /tmp/build-debug.log -i /tmp/8dc230e227105e2 --compress-destination-dir | tee /tmp/oryx-build.log
3:41:20 PM pycairoapp: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
3:41:20 PM pycairoapp: You can report issues at https://github.com/Microsoft/Oryx/issues
3:41:20 PM pycairoapp: Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1
3:41:20 PM pycairoapp: Build Operation ID: f10757e1a2ef2111
3:41:20 PM pycairoapp: Repository Commit : a113b5c6-dfc7-4e89-9506-efe38672c9b9
3:41:20 PM pycairoapp: OS Type : buster
3:41:20 PM pycairoapp: Image Type : githubactions
3:41:20 PM pycairoapp: Detecting platforms...
3:41:21 PM pycairoapp: Detected following platforms:
3:41:21 PM pycairoapp: python: 3.9.18
3:41:21 PM pycairoapp: Version '3.9.18' of platform 'python' is not installed. Generating script to install it...
3:41:21 PM pycairoapp: Using intermediate directory '/tmp/8dc230e227105e2'.
3:41:21 PM pycairoapp: Copying files to the intermediate directory...
3:41:21 PM pycairoapp: Done in 0 sec(s).
3:41:21 PM pycairoapp: Source directory : /tmp/8dc230e227105e2
3:41:21 PM pycairoapp: Destination directory: /home/site/wwwroot
3:41:21 PM pycairoapp: Downloading and extracting 'python' version '3.9.18' to '/tmp/oryx/platforms/python/3.9.18'...
3:41:21 PM pycairoapp: Detected image debian flavor: buster.
3:41:22 PM pycairoapp: Downloaded in 1 sec(s).
3:41:22 PM pycairoapp: Verifying checksum...
3:41:22 PM pycairoapp: Extracting contents...
3:41:24 PM pycairoapp: performing sha512 checksum for: python...
3:41:25 PM pycairoapp: Done in 4 sec(s).
3:41:25 PM pycairoapp: Python Version: /tmp/oryx/platforms/python/3.9.18/bin/python3.9
3:41:25 PM pycairoapp: Creating directory for command manifest file if it does not exist
3:41:25 PM pycairoapp: Removing existing manifest file
3:41:25 PM pycairoapp: Python Virtual Environment: antenv
3:41:25 PM pycairoapp: Creating virtual environment...
3:41:29 PM pycairoapp: Activating virtual environment...
3:41:29 PM pycairoapp: Running pip install...
3:41:37 PM pycairoapp: [10:11:29+0000] Collecting pycairo
3:41:37 PM pycairoapp: [10:11:29+0000] Downloading pycairo-1.25.1.tar.gz (347 kB)
3:41:37 PM pycairoapp: [10:11:29+0000] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 347.1/347.1 kB 43.9 MB/s eta 0:00:00
3:41:37 PM pycairoapp: [10:11:29+0000] Installing build dependencies: started
3:41:37 PM pycairoapp: [10:11:31+0000] Installing build dependencies: finished with status 'done'
3:41:37 PM pycairoapp: [10:11:31+0000] Getting requirements to build wheel: started
3:41:37 PM pycairoapp: [10:11:31+0000] Getting requirements to build wheel: finished with status 'done'
3:41:37 PM pycairoapp: [10:11:31+0000] Installing backend dependencies: started
3:41:37 PM pycairoapp: [10:11:32+0000] Installing backend dependencies: finished with status 'done'
3:41:37 PM pycairoapp: [10:11:32+0000] Preparing metadata (pyproject.toml): started
3:41:37 PM pycairoapp: [10:11:33+0000] Preparing metadata (pyproject.toml): finished with status 'done'
3:41:37 PM pycairoapp: [10:11:33+0000] Building wheels for collected packages: pycairo
3:41:37 PM pycairoapp: [10:11:33+0000] Building wheel for pycairo (pyproject.toml): started
3:41:37 PM pycairoapp: [10:11:37+0000] Building wheel for pycairo (pyproject.toml): finished with status 'done'
3:41:37 PM pycairoapp: [10:11:37+0000] Created wheel for pycairo: filename=pycairo-1.25.1-cp39-cp39-linux_x86_64.whl size=333950 sha256=bc625b34f372249cca49cc021c0d7a2cdbde9f9f24833288ffe2da3537db7a88
3:41:37 PM pycairoapp: [10:11:37+0000] Stored in directory: /usr/local/share/pip-cache/wheels/06/78/24/13b3f4b37dd69876f0c6ba2fa7363708b164766c9f6a2c9d3a
3:41:37 PM pycairoapp: [10:11:37+0000] Successfully built pycairo
3:41:37 PM pycairoapp: [10:11:37+0000] Installing collected packages: pycairo
3:41:37 PM pycairoapp: [10:11:37+0000] Successfully installed pycairo-1.25.1
3:41:37 PM pycairoapp: [notice] A new release of pip is available: 23.0.1 -> 23.3.2
3:41:37 PM pycairoapp: [notice] To update, run: pip install --upgrade pip
3:41:37 PM pycairoapp: Not a vso image, so not writing build commands
3:41:37 PM pycairoapp: Preparing output...
3:41:37 PM pycairoapp: Copying files to destination directory '/tmp/_preCompressedDestinationDir'...
3:41:38 PM pycairoapp: Done in 1 sec(s).
3:41:38 PM pycairoapp: Compressing content of directory '/tmp/_preCompressedDestinationDir'...
3:46:49 PM pycairoapp: Fetching changes.
3:46:50 PM pycairoapp: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/e08358dc-14f3-4290-a04a-0ea0de7bd185.zip (34.53 MB) to /tmp/zipdeploy/extracted
3:46:53 PM pycairoapp: Updating submodules.
3:46:55 PM pycairoapp: Preparing deployment for commit id '681b8464-c'.
3:46:55 PM pycairoapp: PreDeployment: context.CleanOutputPath False
3:46:55 PM pycairoapp: PreDeployment: context.OutputPath /home/site/wwwroot
3:46:55 PM pycairoapp: Repository path is /tmp/zipdeploy/extracted
3:46:55 PM pycairoapp: Running oryx build...
3:46:55 PM pycairoapp: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9 -p virtualenv_name=antenv --log-file /tmp/build-debug.log -i /tmp/8dc230eea93a074 --compress-destination-dir | tee /tmp/oryx-build.log
3:46:56 PM pycairoapp: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
3:46:56 PM pycairoapp: You can report issues at https://github.com/Microsoft/Oryx/issues
3:46:56 PM pycairoapp: Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1
3:46:56 PM pycairoapp: Build Operation ID: 97d7bb8af2c5ddcc
3:46:56 PM pycairoapp: Repository Commit : 681b8464-c2eb-446d-93b2-266210c4c552
3:46:56 PM pycairoapp: OS Type : buster
3:46:56 PM pycairoapp: Image Type : githubactions
3:46:56 PM pycairoapp: Detecting platforms...
3:46:56 PM pycairoapp: Detected following platforms:
3:46:56 PM pycairoapp: python: 3.9.18
3:46:56 PM pycairoapp: Using intermediate directory '/tmp/8dc230eea93a074'.
3:46:57 PM pycairoapp: Copying files to the intermediate directory...
3:46:57 PM pycairoapp: Done in 1 sec(s).
3:46:58 PM pycairoapp: Source directory : /tmp/8dc230eea93a074
3:46:58 PM pycairoapp: Destination directory: /home/site/wwwroot
3:46:58 PM pycairoapp: Python Version: /tmp/oryx/platforms/python/3.9.18/bin/python3.9
3:46:58 PM pycairoapp: Creating directory for command manifest file if it does not exist
3:46:58 PM pycairoapp: Removing existing manifest file
3:46:58 PM pycairoapp: Python Virtual Environment: antenv
3:46:58 PM pycairoapp: Creating virtual environment...
3:47:02 PM pycairoapp: Activating virtual environment...
3:47:02 PM pycairoapp: Running pip install...
3:47:03 PM pycairoapp: [10:17:03+0000] Collecting Pycairo
3:47:03 PM pycairoapp: [10:17:03+0000] Using cached pycairo-1.25.1-cp39-cp39-linux_x86_64.whl
3:47:03 PM pycairoapp: [10:17:03+0000] Installing collected packages: Pycairo
3:47:03 PM pycairoapp: [10:17:03+0000] Successfully installed Pycairo-1.25.1
3:47:03 PM pycairoapp: [notice] A new release of pip is available: 23.0.1 -> 23.3.2
3:47:03 PM pycairoapp: [notice] To update, run: pip install --upgrade pip
3:47:03 PM pycairoapp: Not a vso image, so not writing build commands
3:47:03 PM pycairoapp: Preparing output...
3:47:03 PM pycairoapp: Copying files to destination directory '/tmp/_preCompressedDestinationDir'...
3:47:04 PM pycairoapp: Done in 1 sec(s).
3:47:04 PM pycairoapp: Compressing content of directory '/tmp/_preCompressedDestinationDir'...
3:47:08 PM pycairoapp: Copied the compressed output to '/home/site/wwwroot'
3:47:08 PM pycairoapp: Removing existing manifest file
3:47:08 PM pycairoapp: Creating a manifest file...
3:47:08 PM pycairoapp: Manifest file created.
3:47:08 PM pycairoapp: Copying .ostype to manifest output directory.
3:47:08 PM pycairoapp: Done in 12 sec(s).
3:47:08 PM pycairoapp: Running post deployment command(s)...
3:47:08 PM pycairoapp: Generating summary of Oryx build
3:47:08 PM pycairoapp: Parsing the build logs
3:47:08 PM pycairoapp: Found 0 issue(s)
3:47:09 PM pycairoapp: Build Summary :
3:47:09 PM pycairoapp: ===============
3:47:09 PM pycairoapp: Errors (0)
3:47:09 PM pycairoapp: Warnings (0)
3:47:09 PM pycairoapp: Triggering recycle (preview mode disabled).
3:47:09 PM pycairoapp: Deployment successful. deployer = GITHUB_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip. Remote build.
References:
https://github.com/googlefonts/gftools/issues/121
Upvotes: 0