Unable to view Snappy-compressed files

You must install the python-snappy library on your cluster to view Snappy-compressed files through the Hue File Browser and the HBase Browser. Hue, then, automatically detects and displays the Snappy-compressed files.

Before you begin

The python-snappy library is incompatible with the python library called snappy. You must uninstall snappy if it is present on your cluster.

Run the following command to check whether the snappy library is installed on your cluster:
/usr/bin/pip show snappy
No output on the console indicates that the snappy library is not installed on your cluster. If you get any results for snappy, then uninstall it by running the following command:
/usr/bin/pip uninstall snappy
Check whether you have the python-snappy library is installed on your cluster by running the following command:
/usr/bin/pip show python-snappy
Sample output:
Name: python-snappy
Version: 0.5.4
Location: /usr/lib64/python2.7/site-packages

To resolve this issue:

  1. Sign in to Cloudera Manager as an Administrator.
  2. Stop the Hue service by going to Cluster > $Hue service > Action and click Stop.
  3. Change to the following directory depending on whether you have used parcels or packages to set up your CDH cluster.
    For parcels:
    cd /opt/cloudera/parcels/CDH/lib/hue
    For package:
    cd /usr/lib/hue
  4. Install the python-snappy package by running the following commands:
    yum install gcc gcc-c++ python-devel snappy-devel
    ./build/env/bin/pip install -U setuptools
    ./build/env/bin/pip install python-snappy
  5. Verify that the python-snappy library is readable by all users by running the following commands:
    ls -lart `locate snappy.py`
    The output should be similar to the following:
    -rw-r--r-- 1 root root 11900 Sep  1 12:25 /usr/lib64/python2.7/site-packages/snappy.py
    -rw-r--r-- 1 root root 10344 Sep  1 12:26 /usr/lib64/python2.7/site-packages/snappy.pyc
  6. Start the Hue service by going to Cluster > $Hue service > Action and click Start.
  7. Verify that the python-snappy library is working for Hue by running the following command:
    sudo -u hue /bin/bash -c "echo 'import snappy' | python"

    If the python-snappy library is working as expected, then no output is displayed for this command.

You should now be able to view Snappy-compressed files on the Hue File Browser and the HBase Browser through the Hue web interface.