[Solved] ansible Command Error: Error -5 while decompressing data: incomplete or truncated stream

1. Error message:

An error occurs 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 reports are as follows

[[email protected] 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. Background of error reporting

When installing setuptools inansible-playbook, it terminated unexpectedly, and then execute ansible command to report this error,

 

3. Solution:

Reset setuptools-33.1.1.zip package decompression and installation:

cd setuptools-33.1.1  

python setup.py install

It is normal to try the ansible command after execution. Some friends may not be setuptools, or they may not execute after installing into a package. Please try it yourself.

Read More: