Reputation: 61
I am using a CentOS 7.2 and trying to provision a VM in azure through Ansible using the module "azure_rm_virtualmachine" and getting the error as "No module named packaging.version" Below is my error
Traceback (most recent call last): File "/tmp/ansible_7aeFMQ/ansible_module_azure_rm_virtualmachine.py", line 445, in from ansible.module_utils.azure_rm_common import * File "/tmp/ansible_7aeFMQ/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py", line 29, in ImportError: No module named packaging.version
fatal: [localhost]: FAILED! => { "changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_7aeFMQ/ansible_module_azure_rm_virtualmachine.py\", line 445, in \n from ansible.module_utils.azure_rm_common import *\n File \"/tmp/ansible_7aeFMQ/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\", line 29, in \nImportError: No module named packaging.version\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0 }
Below is my playbook and I am using a ansible version 2.3.0.0 and python version of 2.7.5 and pip 9.0.1
name: Provision new VM in azure hosts: localhost connection: local
tasks:
I am running the playbook from the ansible host and I tried to create a resource group through ansible but I get the same error as "No module named packaging.version" .
Upvotes: 5
Views: 5450
Reputation: 169
The above error is occurred due to your environment doesn't have packaging module.
To solve this issue by installing packaging module.
pip install packaging
The above command will install packaging module of 16.8 version
Upvotes: 7
Reputation: 1406
You may try this, it solved for me
sudo pip install -U pip setuptools
FYI: My ENVs are
Ubuntu 16.04.2 LTS on Windows Subsystem for Linux (Windows 10 bash)
Python 2.7.12
pip 9.0.1
ansible 2.3.1.0
azure-cli (2.0.12)
Upvotes: 0