Traceback with ansible: AttributeError: 'module' object has no attribute '_vendor'

Hi all. I hope you can help me investigating the problem why my ansible installation does not want to run.
I get the following traceback in latest stable “release” as well as git checkout:

seadmin@aconf1a:/sw/ansible_gitclone/ansible/bin> ./ansible
Traceback (most recent call last):
File “./ansible”, line 40, in
from ansible.utils.display import Display
File “/sw/ansible/lib/ansible/utils/display.py”, line 35, in
from ansible import constants as C
File “/sw/ansible/lib/ansible/constants.py”, line 30, in
from ansible.parsing.splitter import unquote
File “/sw/ansible/lib/ansible/parsing/init.py”, line 32, in
from ansible.parsing.vault import VaultLib
File “/sw/ansible/lib/ansible/parsing/vault/init.py”, line 53, in
from Crypto.Hash import SHA256, HMAC
File “build/bdist.linux-x86_64/egg/Crypto/Hash/HMAC.py”, line 66, in
File “build/bdist.linux-x86_64/egg/Crypto/Util/strxor.py”, line 7, in
File “build/bdist.linux-x86_64/egg/Crypto/Util/strxor.py”, line 3, in bootstrap
File “build/bdist.linux-x86_64/egg/pkg_resources/init.py”, line 90, in
AttributeError: ‘module’ object has no attribute ‘_vendor’

My older 2.0.0 ansible installation is running properly.

This is fixed as hacking/env-setup or python setup.py egg_info was executed.

AttributeError: ‘module’ object has no attribute ‘_vendor’

I’m getting this error with v2.0.0-0.3.beta1 on OS X

In my case the fix was to uninstall the cryptography pip I previously installed

I fixed this issue on my Ubuntu 15.10 machine by installing python-paramiko, python-selinux, and python-crypto

Try installing all dependencies from regular ansible package (apt-cache show ansible) - you might have some missing.

If you're encountering this with the PPAs, the 2.0.0.1
python-setuptools was missing as a dependency in the debs that we
built for the PPA. That can cause this error as well. The 2.0.0.2 PPA
build should have fixed that problem.

-Toshio

Hello,

I had similar error:

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

Traceback (most recent call last):
File “/home/pablo/setup/ansible/bin/ansible”, line 74, in
from ansible.cli.adhoc import AdHocCLI as mycli
File “/home/pablo/setup/ansible/lib/ansible/cli/adhoc.py”, line 28, in
from ansible.executor.task_queue_manager import TaskQueueManager
File “/home/pablo/setup/ansible/lib/ansible/executor/task_queue_manager.py”, line 29, in
from ansible.executor.play_iterator import PlayIterator
File “/home/pablo/setup/ansible/lib/ansible/executor/play_iterator.py”, line 29, in
from ansible.playbook.block import Block
File “/home/pablo/setup/ansible/lib/ansible/playbook/init.py”, line 25, in
from ansible.playbook.play import Play
File “/home/pablo/setup/ansible/lib/ansible/playbook/play.py”, line 27, in
from ansible.playbook.base import Base
File “/home/pablo/setup/ansible/lib/ansible/playbook/base.py”, line 35, in
from ansible.parsing.dataloader import DataLoader
File “/home/pablo/setup/ansible/lib/ansible/parsing/dataloader.py”, line 33, in
from ansible.parsing.vault import VaultLib
File “/home/pablo/setup/ansible/lib/ansible/parsing/vault/init.py”, line 68, in
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
File “/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py”, line 12, in
from cryptography.hazmat.primitives import constant_time
File “/usr/lib64/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py”, line 9, in
from cryptography.hazmat.bindings._constant_time import lib
AttributeError: ‘module’ object has no attribute ‘_init_cffi_1_0_external_module’

with all dependencies for ansible installed.

It was solved after removing: sudo dnf remove python-cryptography

it solved the issue immediatelly.

looks like there are some conflicts with python-crypt and python-cryptography.

Unfortunately, with setuptools in the mix it's just as likely that the
two python modules are compatible but when they're installed together
a setuptools bug triggers and causes things like this. setuptools
changes where python is searching for modules based on data installed
globally (all of the egginfo files of packages) so I can kind of see
how that can happen even though I can't see how this particular bug
works :frowning: On Ubuntu we found that even though the bug was experienced
by people with both PyCrypto and Cryptography installed the bug was
really that the setuptools egginfo wasn't installed.

-Toshio

In case this helps someone who finds this thread while Googling, I was able to solve this on Mac OS X by installing the cryptography package system-wide, i.e. “sudo pip install cryptography”.

Dan