Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'azure.mgmt.monitor.version' #715

Closed
dj-wasabi opened this issue Dec 27, 2021 · 6 comments · Fixed by #716
Closed

ModuleNotFoundError: No module named 'azure.mgmt.monitor.version' #715

dj-wasabi opened this issue Dec 27, 2021 · 6 comments · Fixed by #716

Comments

@dj-wasabi
Copy link

SUMMARY

Get an error when I do something with any of the Ansible modules, this is since a few days.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_resourcegroup

ANSIBLE VERSION
ansible [core 2.11.5]
  config file = None
  configured module search path = ['/Users/wdijkerman/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/wdijkerman/.venv3101/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/wdijkerman/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/wdijkerman/.venv3101/bin/ansible
  python version = 3.10.1 (v3.10.1:2cd268a3a9, Dec  6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]. This feature will be removed
from ansible-core in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

# /usr/local/lib/python3.6/site-packages/ansible_collections
Collection      Version
--------------- -------
community.azure 1.1.0
CONFIGURATION
n.a.
OS / ENVIRONMENT

RedHat/Ubuntu

STEPS TO REPRODUCE

Followed: https://docs.microsoft.com/en-us/azure/developer/ansible/configure-in-docker-container?tabs=azure-cli

pip install -r requirements-azure.txt
ansible-galaxy collection install azure.azcollection --force

# create a playbook.yml

---
- hosts: localhost
  connection: local

  vars:
    resource_group_name: somename
    azure_location: germanywestcentral

  tasks:
  - name: Create resource group
    azure_rm_resourcegroup:
      name: "{{ resource_group_name }}"
      location: "{{ azure_location }}"
EXPECTED RESULTS

Creation of an resource group.

ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'azure.mgmt.monitor.version'

@dj-wasabi
Copy link
Author

The https://github.com/ansible-collections/azure/blob/dev/requirements-azure.txt file seems to be changed in the last 3 days. An other playbook is failing since 3 days ago, with same error.

@l3ender
Copy link
Contributor

l3ender commented Dec 28, 2021

I believe the issue is due to installing requirements directly from Github vs the requirements for the collection version being used. As you noticed, the dev branch's requirements were updated, but there has not yet been a release to Galaxy. When using the requirements from Github, this can result in a mismatch between what the module(s) from the collection expect, versus what is installed from the dev branch.

To resolve, please try installing the collection first, and then install requirements from the collection:

pip install -r path/to/installed/collection/requirements-azure.txt

Unless you're providing a custom collection path, the collection should be installed to your home directory and you can use the following:

pip install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt

The readme/documentation is not very clear on this, so I will also open a PR with a suggested change.

Thanks!

@wenesak
Copy link

wenesak commented Dec 28, 2021

Same here this update broke my pipelines, I was downloading the requirements-azure.txt from 'https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt' will try the sugestion from l3ender

@l3ender
Copy link
Contributor

l3ender commented Dec 29, 2021

I've submitted PRs to update the documentation in this repo and on Microsoft's site. If there are any other locations, please let me know and I'd be happy to help update so people are clear on the usage.

Thanks!

@jaydestro
Copy link

using the latest requirements.txt seems to have corrected my issues using default python version with the required modules

@dj-wasabi
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants