question

Shannu avatar image
Shannu asked Kayliegh answered

Unable to connect to CQLSH

Cass Version : 3.11.11

I am facing below issue

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

Shouldn't these packages be installed along with Cassandra Installation

After doing pip install cqlsh

I am facing below error

Traceback (most recent call last):
  File "/bin/cqlsh", line 131, in <module>
    from six import StringIO, ensure_text, ensure_str
ImportError: cannot import name ensure_text

Can I have some help here, Thanks in advance

cqlsh
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered Shannu commented

The errors you posted indicate that there's something wrong in your machine's environment and the wrong Python is getting called.

You can verify which Python is configured by running the following command:

$ which python

This isn't strictly a problem with Cassandra. You will need to figure out what is wrong with your Python installation.

As a workaround, you should be able to run cqlsh by using the system Python:

$ /usr/local/bin/python /usr/bin/cqlsh

Which Linux distribution + version are you running? We've seen this problem previously with CentOS specifically with 6.7 and 7. Cheers!

3 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Shannu avatar image Shannu commented ·

This is the error I face on executing # /usr/bin/python /usr/bin/cqlsh

File "/usr/bin/cqlsh", line 20

python -c 'import sys; sys.exit(not (0x020700b0 < sys.hexversion < 0x03000000))' 2>/dev/null \

^

SyntaxError: invalid syntax

Linux Dist : CentOS Linux release 7.9.2009 (Core)

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ Shannu commented ·
Which Python version are you running?
0 Likes 0 ·
Shannu avatar image Shannu Erick Ramirez ♦♦ commented ·
Python 2.7.5
0 Likes 0 ·
Kayliegh avatar image
Kayliegh answered

Hi,

I got the same issue on Amazon Linux 2.

A workaround for me was to manually install cqlsh with pip like you did, then remove the bundled six lib present here:

/usr/share/cassandra/lib/six-1.7.3-py2.py3-none-any.zip

It forces cqlsh to use the system-wide six lib, which was automatically installed by pip with cqlsh.

I hope this will help you!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.