Unexpected Exception on Ansible 2.0 after installing VirtualBox 5

I’m encountering the following error:

Unexpected Exception: ‘module’ object has no attribute ‘_vendor’

My environment is:
Ubuntu 15.10
Python 2.7
Ansible 2.0 (via the ppa at http://ppa.launchpad.net/ansible/ansible/ubuntu)
VirtualBox 5.0.10

After performing an OS update today, Ansible moved from 1.9.4 to 2.0. At that point I started encountering the error. Uninstalling and reinstalling Ansible did not resolve the error. Uninstalling Python and Ansible, then reinstalling Ansible (via apt-get) did resolve the error. However, after reinstalling VirtualBox 5.0.10 (along with its many Python related dependencies), the error resurfaced.

For the moment, I’m sure I’ll attempt to lock Ansible to 1.9.4, but I’m interested if anyone has feedback related to why this may be occurring and what I may be able to do to resolve the issue.

Here’s the full stack trace:
(the log file is writable by the user, which makes for a puzzling warning message as well).

`
user@machine:/etc/ansible$ ansible --version
[WARNING]: log file at /var/log/ansible.log is not writeable, aborting

Unexpected Exception: ‘module’ object has no attribute ‘_vendor’
the full traceback was:

Traceback (most recent call last):
File “/usr/bin/ansible”, line 74, in
from ansible.cli.adhoc import AdHocCLI as mycli
File “/usr/lib/pymodules/python2.7/ansible/cli/adhoc.py”, line 28, in
from ansible.executor.task_queue_manager import TaskQueueManager
File “/usr/lib/pymodules/python2.7/ansible/executor/task_queue_manager.py”, line 29, in
from ansible.executor.play_iterator import PlayIterator
File “/usr/lib/pymodules/python2.7/ansible/executor/play_iterator.py”, line 29, in
from ansible.playbook.block import Block
File “/usr/lib/pymodules/python2.7/ansible/playbook/init.py”, line 25, in
from ansible.playbook.play import Play
File “/usr/lib/pymodules/python2.7/ansible/playbook/play.py”, line 27, in
from ansible.playbook.base import Base
File “/usr/lib/pymodules/python2.7/ansible/playbook/base.py”, line 35, in
from ansible.parsing.dataloader import DataLoader
File “/usr/lib/pymodules/python2.7/ansible/parsing/dataloader.py”, line 33, in
from ansible.parsing.vault import VaultLib
File “/usr/lib/pymodules/python2.7/ansible/parsing/vault/init.py”, line 66, in
from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
File “/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/hashes.py”, line 15, in
from cryptography.hazmat.backends.interfaces import HashBackend
File “/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/init.py”, line 7, in
import pkg_resources
File “/usr/lib/python2.7/dist-packages/pkg_resources/init.py”, line 90, in
packaging = pkg_resources._vendor.packaging
AttributeError: ‘module’ object has no attribute ‘_vendor’

`

Hi, this is caused by python-setuptools not being installed. We’ll be fixing this in the packaging deps, but for now just install that and you should be good to go.

Thanks!

Hi James,

Many thanks for your reply, it did help resolve the issue I was encountering and it looks as though it’s already been taken care of in the 2.0.0.2 release. Thanks again.

  • Kieran E.