'No module named packaging.version for Ansible VM provisioning in Azure
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:
- name: Create VM azure_rm_virtualmachine: resource_group: xyz name: ScriptVM vm_size: Standard_D1 admin_username: xxxx admin_password: xxxx image: offer: CentOS publisher: Rogue Wave Software sku: '7.2' version: latest
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" .
Solution 1:[1]
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
Solution 2:[2]
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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hariprakash Sambath |
| Solution 2 | Satyan |
