ansible-collections / azure

Development area for Azure Collections
https://galaxy.ansible.com/azure/azcollection
GNU General Public License v3.0
246 stars 332 forks source link

ModuleNotFoundError: No module named 'azure.mgmt.managementgroups' #699

Closed alfador1 closed 2 years ago

alfador1 commented 2 years ago

Describe the bug I install the ansible 2.10, install the azcollection 1.10 (offline ) from tarball in ansible galaxy and then when reaching azure_rm_resourcegroup it fails

. The error was: ModuleNotFoundError: No module named 'azure.mgmt.managementgroups'
00:01:26.596  fatal: [40.118.86.58]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on com-bastion-ansible-runner's Python /usr/bin/python3. 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"}

To Reproduce Steps to reproduce the behavior:

  1. Install ansible 2.10 and azurecollection1.10 offline and run ansible task:

Expected behavior Task passes successfully 00:04:25.614 + pip3 show azure-mgmt-managementgroups

00:04:27.533  Name: azure-mgmt-managementgroups
00:04:27.533  Version: 0.2.0
00:04:27.533  Summary: Microsoft Azure Management Groups Client Library for Python
00:04:27.533  Home-page: https://github.com/Azure/azure-sdk-for-python
00:04:27.533  Author: Microsoft Corporation
00:04:27.533  Author-email: azpysdkhelp@microsoft.com
00:04:27.533  License: MIT License
00:04:27.533  Location: /usr/local/lib/python3.6/site-packages
00:04:27.533  Requires: azure-common, msrest, msrestazure
00:04:27.533  Required-by: 
00:04:27.533  + ansible-galaxy collection list

00:04:28.920  
00:04:28.920  # /usr/local/lib/python3.6/site-packages/ansible_collections
00:04:28.920  Collection                Version
00:04:28.920  ------------------------- -------
00:04:28.920  amazon.aws                1.2.0  
00:04:28.920  ansible.netcommon         1.2.1  
00:04:28.920  ansible.posix             1.1.1  
00:04:28.920  ansible.windows           1.0.0  
00:04:28.920  arista.eos                1.0.3  
00:04:28.920  awx.awx                   14.1.0 
00:04:28.920  azure.azcollection        1.10.0 
00:04:28.920  check_point.mgmt          1.0.6  
00:04:28.920  chocolatey.chocolatey     1.0.2  
00:04:28.920  cisco.aci                 1.0.0  
00:04:28.920  cisco.asa                 1.0.3  
00:04:28.920  cisco.intersight          1.0.8  
00:04:28.920  cisco.ios                 1.0.3  
00:04:28.920  cisco.iosxr               1.0.5  
00:04:28.920  cisco.meraki              2.0.0  
00:04:28.920  cisco.mso                 1.0.0  
00:04:28.920  cisco.nxos                1.1.0  
00:04:28.920  cisco.ucs                 1.5.0  
00:04:28.920  cloudscale_ch.cloud       1.1.0  
00:04:28.920  community.aws             1.2.0  
00:04:28.921  community.crypto          1.1.1  
00:04:28.921  community.digitalocean    1.0.0  
00:04:28.921  community.general         1.1.0  
00:04:28.921  community.grafana         1.0.0  
00:04:28.921  community.kubernetes      1.0.0  
00:04:28.921  community.libvirt         1.0.0  
00:04:28.921  community.mongodb         1.0.0  
00:04:28.921  community.mysql           1.0.0  
00:04:28.921  community.network         1.1.0  
00:04:28.921  community.proxysql        1.0.0  
00:04:28.921  community.rabbitmq        1.0.1  
00:04:28.921  community.skydive         1.0.0  
00:04:28.921  community.vmware          1.2.0  
00:04:28.921  community.windows         1.0.0  
00:04:28.921  community.zabbix          1.0.0  
00:04:28.921  containers.podman         1.2.0  
00:04:28.921  cyberark.conjur           1.0.7  
00:04:28.921  cyberark.pas              1.0.5  
00:04:28.921  dellemc.os10              1.0.1  
00:04:28.921  dellemc.os6               1.0.2  
00:04:28.921  dellemc.os9               1.0.2  
00:04:28.921  f5networks.f5_modules     1.5.0  
00:04:28.921  fortinet.fortimanager     1.0.5  
00:04:28.921  fortinet.fortios          1.0.15 
00:04:28.921  frr.frr                   1.0.3  
00:04:28.921  gluster.gluster           1.0.1  
00:04:28.921  google.cloud              1.0.0  
00:04:28.921  hetzner.hcloud            1.0.0  
00:04:28.921  ibm.qradar                1.0.3  
00:04:28.921  infinidat.infinibox       1.2.3  
00:04:28.921  junipernetworks.junos     1.1.0  
00:04:28.921  mellanox.onyx             1.0.0  
00:04:28.921  netapp.aws                20.8.0 
00:04:28.921  netapp.elementsw          20.8.0 
00:04:28.921  netapp.ontap              20.8.0 
00:04:28.921  netapp_eseries.santricity 1.0.8  
00:04:28.921  netbox.netbox             1.0.2  
00:04:28.921  ngine_io.cloudstack       1.0.1  
00:04:28.921  ngine_io.exoscale         1.0.0  
00:04:28.921  ngine_io.vultr            1.0.0  
00:04:28.921  openstack.cloud           1.1.0  
00:04:28.921  openvswitch.openvswitch   1.0.5  
00:04:28.921  ovirt.ovirt               1.1.3  
00:04:28.921  purestorage.flasharray    1.4.0  
00:04:28.921  purestorage.flashblade    1.3.0  
00:04:28.921  servicenow.servicenow     1.0.2  
00:04:28.921  splunk.es                 1.0.2  
00:04:28.921  theforeman.foreman        1.1.0  
00:04:28.921  vyos.vyos                 1.0.4  
00:04:28.921  wti.remote                1.0.1  

requirements.txt

ansible==2.10.0 packaging requests[security] xmltodict azure-cli-core==2.26.1 azure-common==1.1.11 azure-identity==1.7.0 azure-mgmt-apimanagement==0.2.0 azure-mgmt-authorization==0.51.1 azure-mgmt-batch==5.0.1 azure-mgmt-cdn==3.0.0 azure-mgmt-compute==10.0.0 azure-mgmt-containerinstance==1.4.0 azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerservice==9.1.0 azure-mgmt-datalake-store==0.5.0 azure-mgmt-dns==2.1.0 azure-mgmt-keyvault==1.1.0 azure-mgmt-marketplaceordering==0.1.0 azure-mgmt-monitor==0.5.2 azure-mgmt-managedservices==1.0.0 azure-mgmt-managementgroups==0.2.0 azure-mgmt-network==12.0.0 azure-mgmt-nspkg==2.0.0 azure-mgmt-privatedns==0.1.0 azure-mgmt-redis==5.0.0 azure-mgmt-resource==10.2.0 azure-mgmt-rdbms==1.9.0 azure-mgmt-search==3.0.0 azure-mgmt-servicebus==0.5.3 azure-mgmt-sql==0.10.0 azure-mgmt-storage==11.1.0 azure-mgmt-trafficmanager==0.50.0 azure-mgmt-web==0.41.0 azure-nspkg==2.0.0 azure-storage==0.35.1 msrest==0.6.21 msrestazure==0.6.4 azure-keyvault==1.0.0a1 azure-graphrbac==0.61.1 azure-mgmt-cosmosdb==0.5.2 azure-mgmt-hdinsight==0.1.0 azure-mgmt-devtestlabs==3.0.0 azure-mgmt-loganalytics==1.0.0 azure-mgmt-automation==0.1.1 azure-mgmt-iothub==0.7.0 azure-mgmt-recoveryservices==0.4.0 azure-mgmt-recoveryservicesbackup==0.6.0 azure-mgmt-notificationhubs==2.0.0 azure-mgmt-eventhub==2.0.0 lxml==4.6.3

Output of ansible --version

00:01:04.936  ansible 2.10.15
00:01:04.936    config file = /var/lib/jenkins/workspace/PA-28544-ansible-version-upgrade/ansible.cfg
00:01:04.936    configured module search path = ['/var/lib/jenkins/workspace/PA-28544-ansible-version-upgrade/plugins/modules', '/ansible/library']
00:01:04.936    ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
00:01:04.936    executable location = /usr/local/bin/ansible
00:01:04.936    python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

Additional context Add any other context about the problem here.

Fred-sun commented 2 years ago

@alfador1 According to the error log, your environment caused the error. You are advised to reinstall ansible and requirement.txt. Thank you very much!


sudo pip3 install ansible[azure] -I
sudo pip3 install -r requirment.txt -I
alfador1 commented 2 years ago

@Fred-sun isnt ansible[azure] only for versions bellow 2.10. For 2.10 u use azcollection? I have a container so ansible is reinstalled every time container is build

Fred-sun commented 2 years ago

@alfador1 Ansible-collection depends on Ansible execution(https://github.com/ansible-collections/azure). Thank you very much!


sudo pip3 install ansible[azure] -I
ansible-galaxy collection install azure.azcollection
sudo pip3 install -r requirment.txt -I
alfador1 commented 2 years ago

I install Ansible like that as part of my requirements.txt ansible==2.10.0. Is that also ok? When u define ansible[azure]. How do u knlw which version is it? Is ansible[azure]- something was like that for the older versions? Now just is ansible

Fred-sun commented 2 years ago

@alfador1 I just want you to reinstall ansible, ansible collection and all dependencies, because there is no problem with my local test. It can be determined that it is your environmental problem. thank you!

alfador1 commented 2 years ago

Tried in a seperate python env. Doesn't work

Fred-sun commented 2 years ago

@alfador1 Can you help to provide your error message, as well as ansible and pip information? Thank you very much!

alfador1 commented 2 years ago
(ansible2.10) [root@1e83e0256499 python-venv]# python --version
Python 3.6.8
(ansible2.10) [root@1e83e0256499 python-venv]# ansible --version
ansible 2.10.15
  config file = None
  configured module search path = ['/root/python-venv/plugins/modules', '/ansible/library']
  ansible python module location = /root/python-venv/ansible2.10/lib64/python3.6/site-packages/ansible
  executable location = /root/python-venv/ansible2.10/bin/ansible
  python version = 3.6.8 (default, Oct 11 2019, 15:04:54) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
(ansible2.10) [root@1e83e0256499 python-venv]# ansible-galaxy collection list

# /root/python-venv/ansible2.10/lib/python3.6/site-packages/ansible_collections
Collection                Version
------------------------- -------
amazon.aws                1.2.0
ansible.netcommon         1.2.1
ansible.posix             1.1.1
ansible.windows           1.0.0
arista.eos                1.0.3
awx.awx                   14.1.0
azure.azcollection        1.10.0
check_point.mgmt          1.0.6
chocolatey.chocolatey     1.0.2
cisco.aci                 1.0.0
cisco.asa                 1.0.3
cisco.intersight          1.0.8
cisco.ios                 1.0.3
cisco.iosxr               1.0.5
cisco.meraki              2.0.0
cisco.mso                 1.0.0
cisco.nxos                1.1.0
cisco.ucs                 1.5.0
cloudscale_ch.cloud       1.1.0
community.aws             1.2.0
community.azure           1.0.0
community.crypto          1.1.1
community.digitalocean    1.0.0
community.general         1.1.0
community.grafana         1.0.0
community.kubernetes      1.0.0
community.libvirt         1.0.0
community.mongodb         1.0.0
community.mysql           1.0.0
community.network         1.1.0
community.proxysql        1.0.0
community.rabbitmq        1.0.1
community.skydive         1.0.0
community.vmware          1.2.0
community.windows         1.0.0
community.zabbix          1.0.0
containers.podman         1.2.0
cyberark.conjur           1.0.7
cyberark.pas              1.0.5
dellemc.os10              1.0.1
dellemc.os6               1.0.2
dellemc.os9               1.0.2
f5networks.f5_modules     1.5.0
fortinet.fortimanager     1.0.5
fortinet.fortios          1.0.15
frr.frr                   1.0.3
gluster.gluster           1.0.1
google.cloud              1.0.0
hetzner.hcloud            1.0.0
ibm.qradar                1.0.3
infinidat.infinibox       1.2.3
junipernetworks.junos     1.1.0
mellanox.onyx             1.0.0
netapp.aws                20.8.0
netapp.elementsw          20.8.0
netapp.ontap              20.8.0
netapp_eseries.santricity 1.0.8
netbox.netbox             1.0.2
ngine_io.cloudstack       1.0.1
ngine_io.exoscale         1.0.0
ngine_io.vultr            1.0.0
openstack.cloud           1.1.0
openvswitch.openvswitch   1.0.5
ovirt.ovirt               1.1.3
purestorage.flasharray    1.4.0
purestorage.flashblade    1.3.0
servicenow.servicenow     1.0.2
splunk.es                 1.0.2
theforeman.foreman        1.1.0
vyos.vyos                 1.0.4
wti.remote                1.0.1

# /root/python-venv/ansible2.10/lib64/python3.6/site-packages/ansible_collections
Collection                Version
------------------------- -------
amazon.aws                1.2.0
ansible.netcommon         1.2.1
ansible.posix             1.1.1
ansible.windows           1.0.0
arista.eos                1.0.3
awx.awx                   14.1.0
azure.azcollection        1.10.0
check_point.mgmt          1.0.6
chocolatey.chocolatey     1.0.2
cisco.aci                 1.0.0
cisco.asa                 1.0.3
cisco.intersight          1.0.8
cisco.ios                 1.0.3
cisco.iosxr               1.0.5
cisco.meraki              2.0.0
cisco.mso                 1.0.0
cisco.nxos                1.1.0
cisco.ucs                 1.5.0
cloudscale_ch.cloud       1.1.0
community.aws             1.2.0
community.azure           1.0.0
community.crypto          1.1.1
community.digitalocean    1.0.0
community.general         1.1.0
community.grafana         1.0.0
community.kubernetes      1.0.0
community.libvirt         1.0.0
community.mongodb         1.0.0
community.mysql           1.0.0
community.network         1.1.0
community.proxysql        1.0.0
community.rabbitmq        1.0.1
community.skydive         1.0.0
community.vmware          1.2.0
community.windows         1.0.0
community.zabbix          1.0.0
containers.podman         1.2.0
cyberark.conjur           1.0.7
cyberark.pas              1.0.5
dellemc.os10              1.0.1
dellemc.os6               1.0.2
dellemc.os9               1.0.2
f5networks.f5_modules     1.5.0
fortinet.fortimanager     1.0.5
fortinet.fortios          1.0.15
frr.frr                   1.0.3
gluster.gluster           1.0.1
google.cloud              1.0.0
hetzner.hcloud            1.0.0
ibm.qradar                1.0.3
infinidat.infinibox       1.2.3
junipernetworks.junos     1.1.0
mellanox.onyx             1.0.0
netapp.aws                20.8.0
netapp.elementsw          20.8.0
netapp.ontap              20.8.0
netapp_eseries.santricity 1.0.8
netbox.netbox             1.0.2
ngine_io.cloudstack       1.0.1
ngine_io.exoscale         1.0.0
ngine_io.vultr            1.0.0
openstack.cloud           1.1.0
openvswitch.openvswitch   1.0.5
ovirt.ovirt               1.1.3
purestorage.flasharray    1.4.0
purestorage.flashblade    1.3.0
servicenow.servicenow     1.0.2
splunk.es                 1.0.2
theforeman.foreman        1.1.0
vyos.vyos                 1.0.4
wti.remote                1.0.1

# /root/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 1.10.0
(ansible2.10) [root@1e83e0256499 python-venv]# ^C
(ansible2.10) [root@1e83e0256499 python-venv]# pip list
Package                           Version
--------------------------------- ---------
adal                              1.2.7
ansible                           2.10.0
ansible-base                      2.10.15
applicationinsights               0.11.10
argcomplete                       1.12.3
azure-cli-core                    2.11.1
azure-cli-telemetry               1.0.6
azure-common                      1.1.11
azure-core                        1.20.1
azure-graphrbac                   0.61.1
azure-identity                    1.7.0
azure-keyvault                    1.0.0a1
azure-mgmt-apimanagement          0.2.0
azure-mgmt-authorization          0.51.1
azure-mgmt-automation             0.1.1
azure-mgmt-batch                  5.0.1
azure-mgmt-cdn                    3.0.0
azure-mgmt-compute                10.0.0
azure-mgmt-containerinstance      1.4.0
azure-mgmt-containerregistry      2.0.0
azure-mgmt-containerservice       9.1.0
azure-mgmt-core                   1.2.0
azure-mgmt-cosmosdb               0.5.2
azure-mgmt-datalake-nspkg         2.0.0
azure-mgmt-datalake-store         0.5.0
azure-mgmt-devtestlabs            3.0.0
azure-mgmt-dns                    2.1.0
azure-mgmt-eventhub               2.0.0
azure-mgmt-hdinsight              0.1.0
azure-mgmt-iothub                 0.7.0
azure-mgmt-keyvault               1.1.0
azure-mgmt-loganalytics           1.0.0
azure-mgmt-managedservices        1.0.0
azure-mgmt-managementgroups       0.2.0
azure-mgmt-marketplaceordering    0.1.0
azure-mgmt-monitor                0.5.2
azure-mgmt-network                12.0.0
azure-mgmt-notificationhubs       2.0.0
azure-mgmt-nspkg                  3.0.1
azure-mgmt-privatedns             0.1.0
azure-mgmt-rdbms                  1.9.0
azure-mgmt-recoveryservices       0.4.0
azure-mgmt-recoveryservicesbackup 0.6.0
azure-mgmt-redis                  5.0.0
azure-mgmt-resource               10.2.0
azure-mgmt-search                 3.0.0
azure-mgmt-servicebus             0.5.3
azure-mgmt-sql                    0.10.0
azure-mgmt-storage                11.1.0
azure-mgmt-trafficmanager         0.50.0
azure-mgmt-web                    0.41.0
azure-nspkg                       3.0.1
azure-storage                     0.35.1
bcrypt                            3.2.0
cachetools                        4.2.4
certifi                           2021.10.8
cffi                              1.15.0
chardet                           4.0.0
charset-normalizer                2.0.8
colorama                          0.4.4
cryptography                      3.3.2
dnspython                         2.1.0
google-auth                       2.3.3
humanfriendly                     8.2
idna                              2.10
importlib-metadata                4.8.2
isodate                           0.6.0
Jinja2                            3.0.3
jmespath                          0.10.0
knack                             0.7.2
kubernetes                        19.15.0
lxml                              4.6.3
MarkupSafe                        2.0.1
msal                              1.0.0
msal-extensions                   0.1.3
msrest                            0.6.21
msrestazure                       0.6.4
ntlm-auth                         1.5.0
oauthlib                          3.1.1
packaging                         21.3
paramiko                          2.8.0
pip                               21.3.1
pkginfo                           1.8.1
portalocker                       1.7.1
psutil                            5.8.0
pyasn1                            0.4.8
pyasn1-modules                    0.2.8
pycparser                         2.21
Pygments                          2.10.0
PyJWT                             1.7.1
PyNaCl                            1.4.0
pyOpenSSL                         21.0.0
pyparsing                         3.0.6
python-dateutil                   2.8.2
pywinrm                           0.4.2
PyYAML                            6.0
requests                          2.26.0
requests-ntlm                     1.1.0
requests-oauthlib                 1.3.0
resolvelib                        0.5.4
rsa                               4.8
setuptools                        59.2.0
six                               1.16.0
tabulate                          0.8.9
typing_extensions                 4.0.0
urllib3                           1.26.7
websocket-client                  1.2.1
xmltodict                         0.12.0
zipp                              3.6.0
l3ender commented 2 years ago

I created a fresh virtual environment to see if I could recreate the issue, but everything is working as expected.

Here are the steps I did along with the output, in case it is helpful.

  1. Create virtual environment:

    -> python3 -m venv venv-test && . venv-test/bin/activate && pip3 install --upgrade pip && pip3 install wheel
  2. Install Ansible:

    -> pip3 install ansible==2.10.0
  3. Install Azure collection:

    -> ansible-galaxy collection install azure.azcollection
    Starting galaxy collection install process
    Process install dependency map
    Starting collection install process
    Installing 'azure.azcollection:1.10.0' to '/Users/ross/.ansible/collections/ansible_collections/azure/azcollection'
    Downloading https://galaxy.ansible.com/download/azure-azcollection-1.10.0.tar.gz to /Users/ross/.ansible/tmp/ansible-local-23807tql5n1dq/tmp9ihhd5fn
    azure.azcollection (1.10.0) was installed successfully
  4. Install collection dependencies:

    -> pip3 install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
  5. List collections:

    -> ansible-galaxy collection list
    
    # /Users/ross/.ansible/collections/ansible_collections
    Collection         Version
    ------------------ -------
    ansible.netcommon  2.3.0
    ansible.utils      2.4.2
    azure.azcollection 1.10.0
    
    # /Users/ross/repos/test/venv-test/lib/python3.9/site-packages/ansible_collections
    Collection                Version
    ------------------------- -------
    amazon.aws                1.2.0
    ansible.netcommon         1.2.1
    ansible.posix             1.1.1
    ansible.windows           1.0.0
    arista.eos                1.0.3
    awx.awx                   14.1.0
    azure.azcollection        1.0.0
    check_point.mgmt          1.0.6
    chocolatey.chocolatey     1.0.2
    cisco.aci                 1.0.0
    cisco.asa                 1.0.3
    cisco.intersight          1.0.8
    cisco.ios                 1.0.3
    cisco.iosxr               1.0.5
    cisco.meraki              2.0.0
    cisco.mso                 1.0.0
    cisco.nxos                1.1.0
    cisco.ucs                 1.5.0
    cloudscale_ch.cloud       1.1.0
    community.aws             1.2.0
    community.azure           1.0.0
    community.crypto          1.1.1
    community.digitalocean    1.0.0
    community.general         1.1.0
    community.grafana         1.0.0
    community.kubernetes      1.0.0
    community.libvirt         1.0.0
    community.mongodb         1.0.0
    community.mysql           1.0.0
    community.network         1.1.0
    community.proxysql        1.0.0
    community.rabbitmq        1.0.1
    community.skydive         1.0.0
    community.vmware          1.2.0
    community.windows         1.0.0
    community.zabbix          1.0.0
    containers.podman         1.2.0
    cyberark.conjur           1.0.7
    cyberark.pas              1.0.5
    dellemc.os10              1.0.1
    dellemc.os6               1.0.2
    dellemc.os9               1.0.2
    f5networks.f5_modules     1.5.0
    fortinet.fortimanager     1.0.5
    fortinet.fortios          1.0.15
    frr.frr                   1.0.3
    gluster.gluster           1.0.1
    google.cloud              1.0.0
    hetzner.hcloud            1.0.0
    ibm.qradar                1.0.3
    infinidat.infinibox       1.2.3
    junipernetworks.junos     1.1.0
    mellanox.onyx             1.0.0
    netapp.aws                20.8.0
    netapp.elementsw          20.8.0
    netapp.ontap              20.8.0
    netapp_eseries.santricity 1.0.8
    netbox.netbox             1.0.2
    ngine_io.cloudstack       1.0.1
    ngine_io.exoscale         1.0.0
    ngine_io.vultr            1.0.0
    openstack.cloud           1.1.0
    openvswitch.openvswitch   1.0.5
    ovirt.ovirt               1.1.3
    purestorage.flasharray    1.4.0
    purestorage.flashblade    1.3.0
    servicenow.servicenow     1.0.2
    splunk.es                 1.0.2
    theforeman.foreman        1.1.0
    vyos.vyos                 1.0.4
    wti.remote                1.0.1
  6. List installed pip version:

    -> pip3 freeze
    adal==1.2.7
    ansible==2.10.0
    ansible-base==2.10.15
    applicationinsights==0.11.10
    argcomplete==1.12.3
    azure-cli-core==2.11.1
    azure-cli-telemetry==1.0.6
    azure-common==1.1.11
    azure-core==1.20.1
    azure-graphrbac==0.61.1
    azure-keyvault==1.0.0a1
    azure-mgmt-apimanagement==0.2.0
    azure-mgmt-authorization==0.51.1
    azure-mgmt-automation==0.1.1
    azure-mgmt-batch==5.0.1
    azure-mgmt-cdn==3.0.0
    azure-mgmt-compute==10.0.0
    azure-mgmt-containerinstance==1.4.0
    azure-mgmt-containerregistry==2.0.0
    azure-mgmt-containerservice==9.1.0
    azure-mgmt-core==1.2.0
    azure-mgmt-cosmosdb==0.5.2
    azure-mgmt-datalake-nspkg==2.0.0
    azure-mgmt-datalake-store==0.5.0
    azure-mgmt-devtestlabs==3.0.0
    azure-mgmt-dns==2.1.0
    azure-mgmt-eventhub==2.0.0
    azure-mgmt-hdinsight==0.1.0
    azure-mgmt-iothub==0.7.0
    azure-mgmt-keyvault==1.1.0
    azure-mgmt-loganalytics==1.0.0
    azure-mgmt-managedservices==1.0.0
    azure-mgmt-managementgroups==0.2.0
    azure-mgmt-marketplaceordering==0.1.0
    azure-mgmt-monitor==0.5.2
    azure-mgmt-network==12.0.0
    azure-mgmt-notificationhubs==2.0.0
    azure-mgmt-nspkg==2.0.0
    azure-mgmt-privatedns==0.1.0
    azure-mgmt-rdbms==1.9.0
    azure-mgmt-recoveryservices==0.4.0
    azure-mgmt-recoveryservicesbackup==0.6.0
    azure-mgmt-redis==5.0.0
    azure-mgmt-resource==10.2.0
    azure-mgmt-search==3.0.0
    azure-mgmt-servicebus==0.5.3
    azure-mgmt-sql==0.10.0
    azure-mgmt-storage==11.1.0
    azure-mgmt-trafficmanager==0.50.0
    azure-mgmt-web==0.41.0
    azure-nspkg==2.0.0
    azure-storage==0.35.1
    bcrypt==3.2.0
    certifi==2021.10.8
    cffi==1.15.0
    charset-normalizer==2.0.8
    colorama==0.4.4
    cryptography==36.0.0
    humanfriendly==8.2
    idna==3.3
    isodate==0.6.0
    Jinja2==3.0.3
    jmespath==0.10.0
    knack==0.7.2
    MarkupSafe==2.0.1
    msal==1.0.0
    msal-extensions==0.1.3
    msrest==0.6.21
    msrestazure==0.6.4
    oauthlib==3.1.1
    packaging==21.3
    paramiko==2.8.0
    pkginfo==1.8.1
    portalocker==1.7.1
    pycparser==2.21
    Pygments==2.10.0
    PyJWT==1.7.1
    PyNaCl==1.4.0
    pyOpenSSL==21.0.0
    pyparsing==3.0.6
    python-dateutil==2.8.2
    PyYAML==6.0
    requests==2.26.0
    requests-oauthlib==1.3.0
    six==1.16.0
    tabulate==0.8.9
    urllib3==1.26.7
    xmltodict==0.12.0

The playboook I used for testing:

---
- name: "Playbook for testing."
  hosts: "localhost"
  connection: "local"
  gather_facts: false
  collections:
    - azure.azcollection

  tasks:
    - name: "Create resource group."
      azure_rm_resourcegroup:
        name: "my-test-rg"
        location: "centralus"

Playbook output:

-> ansible-playbook sandbox.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 [Playbook for testing.] ************************************************************************************************************************************************************

TASK [Create resource group.] ***********************************************************************************************************************************************************
changed: [localhost]

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

Ansible/python detail:

-> which ansible
/Users/ross/repos/test/venv-test/bin/ansible

-> ansible --version
ansible 2.10.15
  config file = None
  configured module search path = ['/Users/ross/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/ross/repos/test/venv-test/lib/python3.9/site-packages/ansible
  executable location = /Users/ross/repos/test/venv-test/bin/ansible
  python version = 3.9.6 (default, Jun 29 2021, 05:25:02) [Clang 12.0.5 (clang-1205.0.22.9)]

-> which python
/Users/ross/repos/test/venv-test/bin/python

-> python --version
Python 3.9.6

-> which pip3
/Users/ross/repos/test/venv-test/bin/pip3

-> pip3 --version
pip 21.3.1 from /Users/ross/repos/test/venv-test/lib/python3.9/site-packages/pip (python 3.9)
Fred-sun commented 2 years ago

@alfador1 Why are you using pip in python3? Can you try pip3 Install? Thank you very much!!

Fred-sun commented 2 years ago

@alfador1 I can copy it on my side, if the installation is inconsistent (ansible uses python3, relies on python2), it will cause this error. Or you can rebuild the environment and install it in python3 mode. Thank you very much!