【问题标题】:ERROR! Unexpected Exception, this is probably a bug: cannot import name '_ADDITIONAL_CHECKS' from 'ansible.module_utils.common.parameters'错误!意外异常,这可能是一个错误:无法从 \'ansible.module_utils.common.parameters\' 导入名称 \'_ADDITIONAL_CHECKS\'
【发布时间】:2023-02-06 20:13:31
【问题描述】:

我有以下总是失败的安装脚本

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install virtualenv
pipx install awscli
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
ansible-galaxy install -r ansible/ansible_requirements.yml

if [ ! -d "${HOME}/.aws" ]
then
    echo "${HOME}/.aws does not exist"
    echo "you need to make sure you awscli is correctly configured... invoking configure"
    aws configure
fi

这是以下错误

ERROR! Unexpected Exception, this is probably a bug: cannot import name '_ADDITIONAL_CHECKS' from 'ansible.module_utils.common.parameters' (/home/user100/sagainfra/infrastructure/venv/lib/python3.10/site-packages/ansible/module_utils/common/parameters.py)

我的ansible_requirements.yml

collections:
  - name: amazon.aws
  - name: community.general
  - name: kubernetes.core

这是requirements.txt。我已经尝试最小化此列表,但我仍然面临同样的问题

ansible
ansible-base
ansible-lint
awscli
boto3
botocore
bracex
cffi
click
colorama
commonmark
cryptography
enrich
Jinja2
jmespath
loguru
MarkupSafe
netaddr
packaging
paramiko
prettytable
pyasn1
pycparser
Pygments
pyparsing
python-dateutil
PyYAML
rich
ruamel.yaml
ruamel.yaml.clib
s3transfer
six
tenacity
urllib3
wcmatch
yaspin
pre-commit

怎么修?

【问题讨论】:

  • requirements.txt 中安装了哪些库?

标签: ansible


【解决方案1】:

同样的错误,我得到它的工作:

免责声明:仅当您知道自己在做什么并且确定没有需要 python2.x 的软件时才这样做。

要在没有依赖冲突的情况下使用 python2.x 软件,请使用Python 虚拟环境.

  1. 卸载 Python 2.x:
    为所有版本 2、2.7、2.8 等执行此操作...)

    sudo apt remove python2
    
  2. 清理系统中的 python2.x 依赖项:

    sudo apt -y autoremove
    
  3. 使用 pip3 升级你的 ansible 版本:

    python3 -m pip install ansible --upgrade
    

【讨论】:

  • 我只需要删除ansible-base并删除venv并重新安装
猜你喜欢
  • 1970-01-01
  • 2020-06-15
  • 1970-01-01
  • 2018-12-06
  • 2022-01-27
  • 2021-09-10
  • 2020-04-17
  • 1970-01-01
  • 2022-06-21
相关资源
最近更新 更多