Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open cqlsh Apache cassandra - ImportError: No module named cqlshlib

Tags:

cassandra

I am new to cassandra ! Have downloaded the apacahe cassandra 2.1.2 package and initialy was able to connect to cqlsh but then after installing CCM i am unable to connect , will get the following error

Traceback (most recent call last):
File "bin/cqlsh", line 124, in <module>
from cqlshlib import cql3handling, cqlhandling, pylexotron,sslhandling, copy
ImportError: No module named cqlshlib

Thanks in advance !

like image 659
Shreesha N Avatar asked Feb 04 '16 09:02

Shreesha N


4 Answers

Spent a couple of days, scouring the net moving renaming copying packages .

Easiest workaround for this error that worked :

pip install cqlsh

like image 180
Saleem Ahmed Avatar answered Oct 22 '22 09:10

Saleem Ahmed


You could export PYTHONPATH, to include site package folder where cqlshlib exists

First find the path where cqlshlib exists

find /usr/lib/ -name cqlshlib

Export the path using below variable name

export PYTHONPATH=/usr/lib/python2.7/site-packages/
like image 45
faizan Avatar answered Oct 22 '22 09:10

faizan


I have tried their ways, but failed. And I think cqlsh just cannot find the exact path to cqlshlib.so;

I solved it this way:

  • Centos6.7 ,
  • datastax3.9,
  • my cqlshlib path:/usr/local/lib/python2.7/site-packages/

    vim /usr/bin/cqlsh.py

and add the path of cqlshlib after import sys, the file looks like:

...
import sys
...
from uuid import UUID
sys.path.append("/usr/local/lib/python2.7/site-packages") #add this sentence`

Then I execute cqlsh, it works.

like image 34
David Avatar answered Oct 22 '22 11:10

David


If you're in the cassandra directory, run:

bin/cqlsh

If you check the cqlsh you're running with which cqlsh i suspect you're hitting the ccm one and missing something in your path.

like image 3
Jon Haddad Avatar answered Oct 22 '22 10:10

Jon Haddad