Illustration Image

cqlsh returns "ModuleNotFoundError: No module named 'six.moves'"

I have already installed "six" 1.7.2 in python 2.7.18 with pip, but i receive an error message anyway.

seva@seva-HLYL-WXX9:~$ python --version
Python 2.7.18
seva@seva-HLYL-WXX9:~$ pip install six==1.7.2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Requirement already satisfied: six==1.7.2 in ./.pyenv/versions/2.7.18/lib/python2.7/site-packages (1.7.2)
seva@seva-HLYL-WXX9:~$ cqlsh
Traceback (most recent call last):
  File "/usr/bin/cqlsh.py", line 130, in <module>
    from six.moves import configparser, input
ModuleNotFoundError: No module named 'six.moves'
seva@seva-HLYL-WXX9:~$ pip show six
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: six
Version: 1.7.2
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /home/seva/.pyenv/versions/2.7.18/lib/python2.7/site-packages
Requires: 
Required-by: thrift

Answer

If you want to use python2.7, open cqlsh.py with nano:

sudo nano /usr/bin/cqlsh.py

And change python3 on python2.7.

Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation. Sponsored by Anant Corporation and Datastax, and Developed by Anant Corporation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?