Not able to install azcollection/requirements-azure.txt

I have tried installing with ansible latest version 2.16.6 and 2.15.0.
Also tried with number of python versions as 3.12.3, 3.10.0, 3.11.0.

But getting same error when i do pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt

uamqp/c_uamqp.c:112651:55: error: no member named ‘ob_digit’ in ‘struct _longobject’
const digit* digits = ((PyLongObject*)x)->ob_digit;
~~~~~~~~~~~~~~~~~~ ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
294 warnings and 20 errors generated.
error: command ‘/usr/bin/clang’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for uamqp
Failed to build uamqp
ERROR: Could not build wheels for uamqp, which is required to install pyproject.toml-based projects

How i can install it withput any errors.

I have also tried ignoring these error and running my ansible playbook which uses azure collection, but after manually installing multiple package it again gets me blocked at installing
1.pip3 install azure-mgmt-compute azure-mgmt-network azure-mgmt-storage azure-mgmt-resource
2. pip3 install azure.cli
3.pip install azure.storage.blob
4.pip install azure.mgmt.automation
5.pip install azure.mgmt.notificationhubs
6.pip install azure.mgmt.datafactory
7.
And stucks at
TASK [Check the health of the Azure Web App] **********************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘distutils’
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on MMDV4H9WJCJW5’s Python /Users/mayank.g/Documents/work/autotron-core/SRE-Autotron-DC-Tenant-Autotron-Cloud/ActionScripts/RestartWebAppService/my_project/env/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter”}

PLAY RECAP ********************************************************************************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

(env) mayank.g@MMDV4H9WJCJW5 RestartWebAppService % pip install distutils
ERROR: Could not find a version that satisfies the requirement distutils (from versions: none)
ERROR: No matching distribution found for distutils
(env) mayank.g@MMDV4H9WJCJW5 RestartWebAppService % pip3 install distutils
ERROR: Could not find a version that satisfies the requirement distutils (from versions: none)
ERROR: No matching distribution found for distutils
(env) mayank.g@MMDV4H9WJCJW5 RestartWebAppService %





Also tried on a container based env with below versions
1.Python 3.10.14,
2.pip 24.0 from /app/my_venv/lib/python3.10/site-packages/pip (python 3.10)
3.ansible [core 2.16.6]

**W SAME ERROR HERE ALSO WHILE INSTALLING THE azure/azcollection/requirements-azure.txt

but getting similar error as

(my_venv) 4f158d9d8ae7:/app# ansible-playbook test.yml
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match ‘all’

PLAY [Check Azure Web App status] *********************************************************************************************************************************************************

TASK [Check the health of the Azure Web App] **********************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘msgraph’
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on 4f158d9d8ae7’s Python /app/my_venv/bin/python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter”}

PLAY RECAP ********************************************************************************************************************************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

(my_venv) 4f158d9d8ae7:/app# pip install msgraph
ERROR: Could not find a version that satisfies the requirement msgraph (from versions: none)
ERROR: No matching distribution found for msgraph

Can you share some info about your host OS?

uname -a
cat /etc/os-release

@Denney-tech

Linux 4f158d9d8ae7 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 17:03:36 UTC 2024 x86_64 Linux

NAME=“Alpine Linux”

ID=alpine

VERSION_ID=3.17.6

PRETTY_NAME=“Alpine Linux v3.17”

HOME_URL=“https://alpinelinux.org/

BUG_REPORT_URL=“Issues · alpine / aports · GitLab

4f158d9d8ae7:/app#

Hello Team
Any updates on this issue please
@Denney-tech

Hi, have you tried installing uamqp manually that are failing to build?

The uamqp documentation has the following statement:

If you are running Alpine, you can install from source:

$ apk add --update python3 py-pip python3-dev cmake gcc g++ openssl-dev build-base
$ pip3 install uamqp --no-binary :all:

uamqp · PyPI

So try:

apk add --update python3 py-pip python3-dev cmake gcc g++ openssl-dev build-base
pip3 install uamqp --no-binary :all:
pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt

Any Python modules that use C extensions have a bit bad chemistry with Alpine Linux :disappointed:

1 Like