I have been stuck on Could not build wheels for pycairo, for a week now on Azure Web services

DERBY TENDAI MATOMA 0 Reputation points
2024-01-26T08:42:33.16+00:00

I am getting an error that has been hard to solve with packages ,

pip-cache/wheels/63/be/8a/04843287552b727babbb0e6de7d646d0e0728536f4a5f7ca1c\n[08:32:01+0000] Successfully built django-tenants PyPika svglib\n[08:32:01+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 is available: 23.0.1 -> 23.3.2\n[notice] To update, run: pip install --upgrade pip  
12:32:12 PM kinderkomlowversion: -  Next Steps: Please review your requirements.txt
12:32:12 PM kinderkomlowversion: -  For more details you can browse to https://aka.ms/troubleshoot-python
12:32:12 PM kinderkomlowversion: Warnings (0)
12:32:12 PM kinderkomlowversion: Deployment Failed. deployer = ms-azuretools-vscode deploymentPath = ZipDeploy. Extract zip. Remote build.
12:32:19 PM kinderkomlowversion: Deployment failed.


This error is making sure l can't deploy on Azure webservices, l had a couple people indicating they had to abandon web services and go for Containers, which l did but unfortunately with containers its not deploying and yet not showing whats wrong. I have engaged the support team for some hours now but no avail. So now l am appealing to you my coding super heroes to help with my deployment l am 5 days late with this application.

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
60 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. brtrach-MSFT 15,256 Reputation points Microsoft Employee
    2024-01-28T04:04:07.01+00:00

    @DERBY TENDAI MATOMA I'm sorry to hear that you're having trouble deploying your application on Azure Web Services. Based on the error message you provided, it seems that the issue is related to the pycairo package. The error message indicates that the package failed to build, which is preventing the deployment from succeeding. One possible solution is to review your requirements.txt file and ensure that all the required packages are listed with their correct versions. It's possible that there is a version conflict or missing package that is causing the pycairo package to fail to build. Additionally, you can try upgrading your pip version to the latest version by running the command pip install --upgrade pip. This may help resolve any issues related to outdated pip versions. If these steps do not resolve the issue, you may need to provide more information about your deployment environment and the specific error messages you are seeing in order to troubleshoot further. Let me know if you have any further questions or concerns.

    0 comments No comments

  2. DERBY TENDAI MATOMA 0 Reputation points
    2024-01-28T04:39:03.2+00:00

    Hi, thanks for following up, I got a solution hope it will help. Just in case someone gets this issue, ever. Note the problem only occurs in Azure Linux systems. So there isn't anything you can do locally cause locally these packages are available. I got around it in two ways. The most straightforward way is using containers and in your container you'd explicitly start by installing pycairo in the Linux system, so that means before installing requirements.txt you put this command in your docker file right at the top : sudo apt-get install libcairo2-dev Then install requirements.txt and the rest of the docker file, perhaps yaml file too solution 2: Using Azure Web apps: Find an Azure Python run time that can at least create builds without showing the error. So for me, python 3.9 worked thats after trying all versions from 3.12 to 3.8. When the builds and deployment run. Go to the custom commands in the portal, this is somewhere at the settings, and you will find it. There is an input field where you can put custom commands like you start website command if you are using Gunicorn and so on. Before starting the app enter

    sudo apt-get install libcairo2-dev
    
    
    

    command. That way the library is installed just before starting the app. So overall the thingy we'll work. This gave me a headache hope someone gets some value from it.

    0 comments No comments