Ansible 角色/包 - Ansible Galaxy - 安装 MAC OSX 时出错
Posted
技术标签:
【中文标题】Ansible 角色/包 - Ansible Galaxy - 安装 MAC OSX 时出错【英文标题】:Ansible roles/packages - Ansible Galaxy - error on installation MAC OSX 【发布时间】:2016-08-25 18:47:25 【问题描述】:我正在尝试通过 CLI 在 Mac OS X El Capitan 上安装 ansible-galaxy 角色
$ ansible-galaxy install -r requirements.yml
我收到此错误:
ERROR! Unexpected Exception: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('setuptools>=11.3'))
the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible-galaxy", line 73, in <module>
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
File "/Library/Python/2.7/site-packages/ansible/cli/galaxy.py", line 38, in <module>
from ansible.galaxy.role import GalaxyRole
File "/Library/Python/2.7/site-packages/ansible/galaxy/role.py", line 35, in <module>
from ansible.playbook.role.requirement import RoleRequirement
File "/Library/Python/2.7/site-packages/ansible/playbook/__init__.py", line 25, in <module>
from ansible.playbook.play import Play
File "/Library/Python/2.7/site-packages/ansible/playbook/play.py", line 27, in <module>
from ansible.playbook.base import Base
File "/Library/Python/2.7/site-packages/ansible/playbook/base.py", line 35, in <module>
from ansible.parsing.dataloader import DataLoader
File "/Library/Python/2.7/site-packages/ansible/parsing/dataloader.py", line 32, in <module>
from ansible.parsing.vault import VaultLib
File "/Library/Python/2.7/site-packages/ansible/parsing/vault/__init__.py", line 67, in <module>
from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256
File "/Library/Python/2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module>
from cryptography.hazmat.backends.interfaces import HashBackend
File "/Library/Python/2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2797, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 580, in resolve
raise VersionConflict(dist,req) # XXX put more info here
VersionConflict: (setuptools 1.1.6 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('setuptools>=11.3'))
【问题讨论】:
能否将您尝试安装的文件添加到您的问题中? 我正在尝试设置这个 github.com/roots/roots-example-project.com 安装外部 Ansible 角色/包 # @root-example-project.com/trellis $ ansible-galaxy install -r requirements.yml 看起来它提供了 Vagrant。我会用它来设置实例 是的,但是在 Vagrant init 之前,我需要安装 Ansible 角色/包,并且出现错误 哦,对了。很难阅读您的错误,但它似乎在说明您的某个 python 包已过时。 【参考方案1】:运行以下命令升级python
用户下的setuptools:
pip install --upgrade setuptools --user python
由于某种原因,在 OS X 中安装东西的方式(在我的例子中,在 CentOS 7 下的 Docker 容器中),setuptools 包没有在正确的用户下正确安装。
【讨论】:
在我的 Mac 上,运行重新安装的 setuptools-1.1.6。收集 setuptools 下载 setuptools-22.0.0-py2.py3-none-any.whl (509kB) 100% |██████████████████████████ ██████| 512kB 1.6MB/s 要求已经更新:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload 中的python 安装收集的包:setuptools 成功安装setuptools-1.1。 6 即使我收到与@rhuffstedtler 相同的消息,我也没有再收到警告,我可以继续运行我正在运行的 Ansible playbook。 我将 setuptools=11.3 添加到了我的 requirements.txt 中,它起作用了。以上是关于Ansible 角色/包 - Ansible Galaxy - 安装 MAC OSX 时出错的主要内容,如果未能解决你的问题,请参考以下文章