Azure / actions-workflow-samples

Help developers to easily get started with GitHub Action workflows to deploy to Azure
https://github.com/Azure/actions
MIT License
447 stars 624 forks source link

python pipeline - build issue with pycairo and wheel #136

Open Coni63 opened 1 year ago

Coni63 commented 1 year ago

Hello,

On the Deploy to Azure Web App pipeline, I have an issue during the build of the library pycairo. I initially run all my tests using also linux-latest + venv without any issue. However, after the "build artifact creation", I have the following step(auto-generated in Azure) :

      - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: 'codingame-readme-stats'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_XXXXXXXXXXXXXXXXXXXXX }}

And here is the error (simplified):

Package deployment using ZIP Deploy initiated.
Updating submodules.
Preparing deployment for commit id '6a[9](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:10)e1c57-4'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.[10](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:11) -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8daeda0374b72e5 --compress-destination-dir | tee /tmp/oryx-build.log
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20220825.1, Commit: 24032445dbf7bf6ef068688f1b123a7144453b7f, ReleaseTagName: 20220825.1

Build Operation ID: |P9tGMmVKHdk=.f0177919_
Repository Commit : 6a9e1c57-41cf-4ccb-a3e9-2df5d8ca2f90

Detecting platforms...
Detected following platforms:
  python: 3.10.8
Version '3.10.8' of platform 'python' is not installed. Generating script to install it...

Using intermediate directory '/tmp/8daeda0374b72e5'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8daeda0374b72e5
Destination directory: /home/site/wwwroot

Downloading and extracting 'python' version '3.10.8' to '/tmp/oryx/platforms/python/3.10.8'...
Detected image debian flavor: bullseye.
Downloaded in 2 sec(s).
Verifying checksum...
Extracting contents...
performing sha512 checksum for: python...
Done in 14 sec(s).

image detector file exists, platform is python..
OS detector file exists, OS is bullseye..
Python Version: /tmp/oryx/platforms/python/3.10.8/bin/python3.10
Creating directory for command manifest file if it does not exist
Removing existing manifest file
Python Virtual Environment: antenv
Creating virtual environment...
Activating virtual environment...
Running pip install...

[...]

[15:36:42+0000] Collecting pycairo==1.23.0
[15:36:42+0000]   Downloading pycairo-1.23.0.tar.gz (344 kB)
[15:36:42+0000]      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 344.6/344.6 kB 4.4 MB/s eta 0:00:00
[15:36:42+0000]   Installing build dependencies: started
[15:36:47+0000]   Installing build dependencies: finished with status 'done'
[15:36:47+0000]   Getting requirements to build wheel: started
[15:36:48+0000]   Getting requirements to build wheel: finished with status 'done'
[15:36:48+0000]   Installing backend dependencies: started
[15:36:50+0000]   Installing backend dependencies: finished with status 'done'
[15:36:50+0000]   Preparing metadata (pyproject.toml): started
[15:36:51+0000]   Preparing metadata (pyproject.toml): finished with status 'done'

[...]

[15:36:53+0000] Building wheels for collected packages: pycairo
[15:36:53+0000]   Building wheel for pycairo (pyproject.toml): started
[15:36:54+0000]   Building wheel for pycairo (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Building wheel for pycairo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/cairo
      copying cairo/__init__.py -> build/lib.linux-x86_64-cpython-310/cairo
      copying cairo/__init__.pyi -> build/lib.linux-x86_64-cpython-310/cairo
      copying cairo/py.typed -> build/lib.linux-x86_64-cpython-310/cairo
      running build_ext
      Package cairo was not found in the pkg-config search path.
      Perhaps you should add the directory containing `cairo.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'cairo' found
      Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycairo
[15:36:54+0000] Failed to build pycairo
ERROR: Could not build wheels for pycairo, which is required to install pyproject.toml-based projects

Notice:  A new release of pip available: 22.2.2 -> 22.3.1
Notice:  To update, run: pip install --upgrade pip

Notice:  To update, run: pip install --upgrade pip | Exit code: 1 | Please review your requirements.txt | More information: https://aka.ms/troubleshoot-python
\n/bin/bash -c "oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.10 -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8daeda0374b72e5 --compress-destination-dir | tee /tmp/oryx-build.log ; exit $PIPESTATUS "

Generating summary of Oryx build
Parsing the build logs
Found 1 issue(s)

Build Summary :
===============
Errors (1)

[...]

[15:36:[53](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:54)+0000] Building wheels for collected packages: pycairo\n[15:36:53+0000]   Building wheel for pycairo (pyproject.toml): started\n[15:36:[54](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:55)+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](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:65)-cpython-310\n      creating build/lib.linux-x[86](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:87)_64-cpython-[310](https://github.com/Coni63/codingame-readme-stats/actions/runs/3830803586/jobs/6519141948#step:3:311)/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[15:36:54+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 -> 22.3.1\n[notice] To update, run: pip install --upgrade pip  
-  Next Steps: Please review your requirements.txt
-  For more details you can browse to https://aka.ms/troubleshoot-python

Warnings (0)

Deployment Failed. deployer = GITHUB_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip. Remote build.
Error: Failed to deploy web package to App Service.
Error: Deployment Failed with Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
App Service Application URL: https://codingame-readme-stats.azurewebsites.net/

I found on this link some commands but how can I add them in the pipeline ?

pip install --upgrade pip
pip install --upgrade setuptools wheel

Should I copy-paste the whole [python.yml](https://github.com/Azure/actions-workflow-samples/blob/master/AppService/python-webapp-on-azure.yml) instead of the preconfigured command from azure ?

Many thanks in advance