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

前端 未结 8 744
猫巷女王i
猫巷女王i 2020-12-18 20:55

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 ,

相关标签:
8条回答
  • 2020-12-18 21:14

    Workaround:

    I assume that you have already installed Cassandra and cqlshlib has been installed in /usr/lib/python2.7/site-packages/

    `ln -s /usr/lib/python2.7/site-packages/cqlshlib /usr/local/lib/python2.7/site-packages/cqlshlib` 
    

    (replace /usr/lib/python2.7/site-packages with your python directory).

    More Detail:

    One possibility is that your default python is not in /usr/bin/. Say it has been installed in /usr/local/bin/. However, Cassandra seems to install cqlshlib in /usr/lib/python2.7/site-packages for some reason. As a result, the default python cannot find cqlshlib package when you run cqlsh command.

    0 讨论(0)
  • 2020-12-18 21:18

    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.

    0 讨论(0)
  • 2020-12-18 21:23

    The other answers correctly diagnose the problem. You need to find the correct cqlshlib. I had installed cassandra with apt get to Ubuntu, so the correct path for me was /usr/local/apache-cassandra-3.11.3/pylib

    I had also messed things up by previously doing pip install cqlsh This is NOT supported by the apache team!

    Like another answer here, I hacked the cqlsh.py file in /usr/bin

    My successful hack was to replace the commented out line with the line below it.

    #cqlshlibdir = os.path.join(CASSANDRA_PATH, 'pylib')
    cqlshlibdir = "/usr/local/apache-cassandra-3.11.3/pylib"
    
    0 讨论(0)
  • 2020-12-18 21:26

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

    Easiest workaround for this error that worked :

    pip install cqlsh

    0 讨论(0)
  • 2020-12-18 21:29

    Just start cqlsh with root,

      sudo cqlsh <ipaddress>
    
    0 讨论(0)
  • 2020-12-18 21:31

    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/
    
    0 讨论(0)
提交回复
热议问题