}

error: Not a recognized archive type: Twisted tar.bz2

Created:

The error:Not a recognized archive type bz2

When you try to install with pip some libraries you can get the error:

Processing dependencies for faradaysec==3.8.1 Searching for twisted==18.9.0 Reading https://pypi.org/simple/twisted/ Downloading https://files.pythonhosted.org/packages/5d/0e/a72d85a55761c2c3ff1cb968143a2fd5f360220779ed90e0fadf4106d4f2/Twisted-18.9.0.tar.bz2#sha256=294be2c6bf84ae776df2fc98e7af7d6537e1c5e60a46d33c3ce2a197677da395 Best match: Twisted 18.9.0 Processing Twisted-18.9.0.tar.bz2 error: Not a recognized archive type: /tmp/easy_install-BjRS0O/Twisted-18.9.0.tar.bz2

This usually happens with:

pip install Twisted -U

Solution

This happens when python has no bz2 builtin modules installed. You can list buildint modules with:

dir(__builtins__) ['ArithmeticError', ..... 'zip']

If the bz2 module is missing you will need to install bz2 lib (libbz2.so) and then recompile python. You can also try to download a precompiled versin of python, that will come with bz2 module compiled.

You can install bz2 libe on ubuntu/debian with:

sudo apt-get install libbz2-dev

On fedora/centos/redhat:

sudo yum install bzip2-devel