Ansible DistributionNotFound加密和其他错误

时间:2016-06-08 17:20:33

标签: vagrant ansible ansible-playbook

我从其他开发人员那里得到了一个项目,现在无法访问。 在做流浪汉时,它开始构建盒子,但它似乎总是崩溃。

第一个问题是缺少ImportError: No module named markupsafe,但我可以解决这个问题。 问题是下一个是DistributionNotFound: The 'cryptography>=1.1' distribution was not found and is required by paramiko

所以我似乎遇到了ansible运行中的错误。有什么想法吗?

控制台日志:

==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: ERROR! Unexpected Exception: The 'cryptography>=1.1' distribution was not found and is required by paramiko
==> default: the full traceback was:
==> default: 
==> default: Traceback (most recent call last):
==> default:   File "/usr/local/bin/ansible-playbook", line 79, in <module>
==> default:     mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/cli/playbook.py", line 30, in <module>
==> default:     from ansible.executor.playbook_executor import PlaybookExecutor
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/executor/playbook_executor.py", line 27, in <module>
==> default:     from ansible.executor.task_queue_manager import TaskQueueManager
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 28, in <module>
==> default:     from ansible.executor.play_iterator import PlayIterator
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/executor/play_iterator.py", line 29, in <module>
==> default:     from ansible.playbook.block import Block
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 25, in <module>
==> default:     from ansible.playbook.play import Play
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/play.py", line 27, in <module>
==> default:     from ansible.playbook.base import Base
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/base.py", line 35, in <module>
==> default:     from ansible.parsing.dataloader import DataLoader
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/parsing/dataloader.py", line 33, in <module>
==> default:     from ansible.parsing.vault import VaultLib
==> default:   File "/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py", line 67, in <module>
==> default:     from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
==> default:   File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/hashes.py", line 20, in <module>
==> default:     from cryptography.hazmat.backends.interfaces import HashBackend
==> default:   File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 16, in <module>
==> default:     import pkg_resources
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
==> default:     @_call_aside
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
==> default:     f(*args, **kwargs)
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
==> default:     working_set = WorkingSet._build_master()
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
==> default:     return cls._build_from_requirements(__requires__)
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
==> default:     dists = ws.resolve(reqs, Environment())
==> default:   File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 829, in resolve
==> default:     raise DistributionNotFound(req, requirers)
==> default: DistributionNotFound: The 'cryptography>=1.1' distribution was not found and is required by paramiko
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

注意:执行vagrant ssh进行本地安装时,表示已经满意:

vagrant@debian-jessie:/vagrant$ pip install cryptography
Requirement already satisfied (use --upgrade to upgrade): cryptography in /usr/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): cffi>=0.8 in /usr/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=0.8->cryptography)

1 个答案:

答案 0 :(得分:2)

您缺少一些开发库。在debian / ubuntu系统中,输入以下内容:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev