[Solved] Ansible command reported Error -5 while decompressing data: incomplete or truncated stream

1. Error message: 

An error is reported when executing the ansible command

ERROR! Unexpected Exception, this is probably a bug: Error -5 while decompressing data: incomplete or truncated stream

The detailed error is as follows

[root@localhost tmp]# ansible -h
ERROR! Unexpected Exception, this is probably a bug: Error -5 while decompressing data: incomplete or truncated stream
the full traceback was:

Traceback (most recent call last):
  File "/usr/bin/ansible", line 97, in <module>
    mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
  File "/usr/lib/python2.7/site-packages/ansible/cli/__init__.py", line 38, in <module>
    from ansible.inventory.manager import InventoryManager
  File "/usr/lib/python2.7/site-packages/ansible/inventory/manager.py", line 36, in <module>
    from ansible.plugins.loader import inventory_loader
  File "/usr/lib/python2.7/site-packages/ansible/plugins/loader.py", line 22, in <module>
    from ansible.parsing.utils.yaml import from_yaml
  File "/usr/lib/python2.7/site-packages/ansible/parsing/utils/yaml.py", line 17, in <module>
    from ansible.parsing.yaml.loader import AnsibleLoader
  File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/loader.py", line 30, in <module>
    from ansible.parsing.yaml.constructor import AnsibleConstructor
  File "/usr/lib/python2.7/site-packages/ansible/parsing/yaml/constructor.py", line 29, in <module>
    from ansible.parsing.vault import VaultLib
  File "/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py", line 42, in <module>
    from cryptography.hazmat.backends import default_backend
  File "/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
    import pkg_resources
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 70, in <module>
  File "build/bdist.linux-x86_64/egg/pkg_resources/extern/__init__.py", line 43, in load_module
    __import__(extant)
error: Error -5 while decompressing data: incomplete or truncated stream

2. The background of the error

When I installed setuptools in ansible-playbook, it terminated unexpectedly, and then executed the ansible command to report this error.

None of the solutions I searched on the Internet can solve my problem. The methods that are useless to me are as follows:

        1. Many people say that they want to uninstall the cryptography package and reinstall ansible

        2. Insufficient memory, need to increase memory: I checked that the server has sufficient memory

        ……

Tried various methods to no avail.

3. Solution :

Re-decompress and install the setuptools-33.1.1.zip package:

cd setuptools-33.1.1  

python setup.py install

After the execution is complete, try the ansible command again. Some friends may not be setuptools, or they may not be able to execute after installing a certain package, please try it yourself.

Guess you like

Origin blog.csdn.net/yy4545/article/details/122978962