2

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

Eman
  • 111
  • 1
  • 4
  • 14
  • what does `which python` say? – anthony sottile Apr 23 '17 at 19:19
  • it says nothing – Eman Apr 24 '17 at 07:09
  • but when I type whereis python it appears python: /usr/bin/python3.5m /usr/bin/python3.5 /usr/lib/python2.7 /usr/lib/python3.5 /etc/python3.5 /usr/local/bin/python2.7-config /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/local/lib/python3.5 /usr/share/python – Eman Apr 24 '17 at 07:19
  • when I Type: ls -l /usr/bin/python* it appears to me: lrwxrwxrwx 1 root root 9 Apr 23 19:20 /usr/bin/python3 -> python2.7 -rwxr-xr-x 1 root root 976 Nov 27 2015 /usr/bin/python3-jsondiff -rwxr-xr-x 1 root root 3662 Nov 27 2015 /usr/bin/python3-jsonpatch -rwxr-xr-x 1 root root 1342 Oct 24 2015 /usr/bin/python3-jsonpointer -rwxr-xr-x 2 root root 4460336 Nov 17 19:23 /usr/bin/python3.5 -rwxr-xr-x 2 root root 4460336 Nov 17 19:23 /usr/bin/python3.5m lrwxrwxrwx 1 root root 10 Mar 23 2016 /usr/bin/python3m -> python3.5m – Eman Apr 24 '17 at 08:33

2 Answers2

1

For centos 8 and other similarly:

  • Install python 2.7

  • Then, prior to invoking cqlsh, run:

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

thebluephantom
  • 16,458
  • 8
  • 40
  • 83
0

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

anthony sottile
  • 61,815
  • 15
  • 148
  • 207