launching cassandra cqlsh python not found

2.9k Views Asked by At

I am trying to install cassandra version 2.2.0 and I found the compatible python version for it is 2.7.10 then I installed it. when I type in terminal

python2.7 --version Python 2.7.10

but when I launch cassandra server and want to start cassandra query language shell by typing root@eman:/usr/local/cassandra# bin/cqlsh bin/cqlsh: 19: bin/cqlsh: python: not found

how could I fix this issue

thanks in advance

2

There are 2 best solutions below

0
anthony sottile On

It seems that python is not installed on your machine (for whatever reason).

cqlsh shells out to python (in a rather strange way): https://github.com/spiside/cqlsh/blob/6f5b680fed2e48e37107fd1da272e351e5ac257d/cqlsh#L1-L30

Unrelated to this stackoverflow issue, I attempted to fix (and probably fixed) this in the latest version of cqlsh: https://github.com/spiside/cqlsh/commit/a880445ec9d05cfa552928d5a88d1457640456b6

If you can upgrade cqlsh it may fix this.

If you can't upgrade cqlsh any of the following things should fix this: - If you're on an debian-like system apt-get install python-minimal -- this provides the /usr/bin/python file that seems to be missing (for whatever reason) - If your package manager has a package which provides the /usr/bin/python symlink, install that - Otherwise, set up a symlink that's on your path, for example ln -sf /usr/bin/python2.7 /usr/local/bin/python

0
thebluephantom On

For centos 8 and other similarly:

  • Install python 2.7

  • Then, prior to invoking cqlsh, run:

    sudo alternatives --set python /usr/bin/python2