KB Article #178590

Running Cassandra cqlsh on Linux systems with Python 2.6

Problem

The API Gateway Appliance platform version 7.0.2 and a system upgraded to 7.1.2 does not support cqlsh (CQL shell) because the included version of Python 2.6 is too old. (These appliances use python version 2.6.9 and cqlsh requires at least 2.7.)

This is also true for Red Hat 6 based systems which bundle python 2.6.

A Cassandra cluster cannot be set up on python 2.6 platforms because cqlsh is needed to set the replication factor. Up to now the only workaround was to run a remote cqlsh to the Cassandra instance.


Resolution

Install the attached RPM. This puts a copy of Python 2.7.11 under /opt/python2.7 which can be used to execute cqlsh.


This installs its own (independent) Python file hierarchy; the default Python 2.6 will stay installed and remains the version executed by default (by running "python").


Steps:

1. Install the rpm, "--nodeps" is required because of unmet package dependencies; but the RPM will be successfully installed.

sudo rpm -i -f python-2.7.11.rpm --nodeps


2. Temporarily change the shell environment to pick up python 2.7

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/python2.7/lib

/opt/python2.7/bin/python /opt/apache-cassandra-2.2.5/bin/cqlsh.py


3. If no errors then make the following change so just our Cassandra cqlsh will pick up Python from /opt/python2.7 (assuming Cassandra has been installed in /opt/cassandra).

sed -i  '1 i\PATH=/opt/python2.7/bin:$PATH' /opt/cassandra/bin/cqlsh

sed -i  '1 i\LD_LIBRARY_PATH=/opt/python2.7/lib:$LD_LIBRARY_PATH' /opt/cassandra/bin/cqlsh

sed -i  '1 i\#!/bin/sh' /opt/cassandra/bin/cqlsh