Error when using cassandra-driver 3.0.0

1,522 views
Skip to first unread message

Lahiru

unread,
Feb 3, 2016, 4:34:14 PM2/3/16
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi Users,


Installed cassandra-driver using pip and tried to do some simple code and I get following error in my import line (from cassandra.cluster import Cluster)

line 11, in <module>
    from cassandra.cluster import Cluster
  File "cassandra/cluster.py", line 49, in init cassandra.cluster (cassandra/cluster.c:71100)
    from cassandra.connection import (ConnectionException, ConnectionShutdown,
  File "cassandra/connection.py", line 38, in init cassandra.connection (cassandra/connection.c:27766)
    from six.moves.queue import Queue, Empty  # noqa
ImportError: No module named queue
Internal Server Error: /dashboard
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 90, in get_response
    response = middleware_method(request)
  File "/Library/Python/2.7/site-packages/django/middleware/common.py", line 71, in process_request
    if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 573, in is_valid_path
    resolve(path, urlconf)
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 453, in resolve
    return get_resolver(urlconf).resolve(path)
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 318, in resolve
    for pattern in self.url_patterns:
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 346, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 341, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/lahiru/highfive/md/md/bootstrap/urls.py", line 9, in <module>
    import environments
  File "/Users/lahiru/highfive/md/md/bootstrap/environments.py", line 11, in <module>
    from cassandra.cluster import Cluster
  File "cassandra/cluster.py", line 49, in init cassandra.cluster (cassandra/cluster.c:71100)
    from cassandra.connection import (ConnectionException, ConnectionShutdown,

Someone please help me why its not working when I follow instructions.

Adam Holmberg

unread,
Feb 3, 2016, 4:48:03 PM2/3/16
to python-dr...@lists.datastax.com
It's failing to import from a third-party package named 'six'.

This is specified as a package dependency, and should be installed by default under normal circumstances. A few more details might help us get further:

1.) What is the specific runtime
2.) Method of installation (anything more than a simple pip install? from index? local?)
3.) Your version of Cython used in the build
4.) The version of six installed in this environment, and whether you're able to do that import statement yourself

That should give use a good shot at understanding or reproducing.

Regards,
Adam Holmberg


--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Lahiru Gamathige

unread,
Feb 3, 2016, 4:56:47 PM2/3/16
to python-dr...@lists.datastax.com
Hi Adam,
Thanks for the prompt response.

I am on Mac, El Captain.

I have to use pip for the installation. 

I haven't installed cython at all because there's wasn't any instructions for that.

This is my six version details

Lahirus-MacBook-Pro:md lahiru$ pip show six

---

Metadata-Version: 1.1

Name: six

Version: 1.4.1

Summary: Python 2 and 3 compatibility utilities

Home-page: http://pypi.python.org/pypi/six/

Author: Benjamin Peterson

Author-email: benj...@python.org

License: UNKNOWN

Location: /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Requires: 

Alan Boudreault

unread,
Feb 3, 2016, 5:10:41 PM2/3/16
to python-dr...@lists.datastax.com
Your six version doesn't match our driver requirements (six>=1.6). six.moves.queue doesn't exist in six version 1.4. 

As a quick fix, upgrade your six version:

pip install --upgrade six

What cassandra-driver version are you using?


Alan Boudreault
Software Engineer in Test | alan.bo...@datastax.com

Alan Boudreault

unread,
Feb 3, 2016, 5:34:57 PM2/3/16
to python-dr...@lists.datastax.com
Sorry, just noticed you are using 3.0.0. The six requirement for that release seems to be correct. So it looks like something in your environment failed when installing. Normally, pip would have upgraded the six package when installing the driver.

Let me know if you have anything else that could be useful to reproduce.

Thanks,
Alan

Lahiru Gamathige

unread,
Feb 3, 2016, 10:54:43 PM2/3/16
to python-dr...@lists.datastax.com
I re-installed the cassandra-driver and this it the output.

Collecting cassandra-driver==3.0.0

  Using cached cassandra-driver-3.0.0.tar.gz

Collecting six>=1.6 (from cassandra-driver==3.0.0)

  Using cached six-1.10.0-py2.py3-none-any.whl

Requirement already satisfied (use --upgrade to upgrade): futures in /Library/Python/2.7/site-packages (from cassandra-driver==3.0.0)

Building wheels for collected packages: cassandra-driver

  Running setup.py bdist_wheel for cassandra-driver ... done

  Stored in directory: /Users/lahiru/Library/Caches/pip/wheels/38/49/41/2faf151facb657d83ac66ee0255d7286160fb54e203694d9c1

Successfully built cassandra-driver

Installing collected packages: six, cassandra-driver

Successfully installed cassandra-driver-3.0.0 six-1.10.0


And tried to upgrade six and this is the output.


Lahirus-MacBook-Pro:md lahiru$ pip install --upgrade six

Requirement already up-to-date: six in /usr/local/lib/python2.7/site-packages



Does this driver 3.0.0 works in El captain ?

Alan Boudreault

unread,
Feb 4, 2016, 8:24:51 AM2/4/16
to python-dr...@lists.datastax.com
It is not clear to me why the installation logs report that six 1.10 has been installed and that your "pip show six" says something else. It seems more related to your environment than the cassandra driver. I suggest using a virtualenv if possible. 

Regards,
Alan

Jack Lista

unread,
Jan 9, 2018, 6:07:53 PM1/9/18
to DataStax Python Driver for Apache Cassandra User Mailing List
 Hi Alan,

Is this datastax python driver still in use?  I'm on OSX (10.11.6) and I'm seeing the same error as these folks are seeing.  When I simply add the import statement into my python code, it gives me this error:

Traceback (most recent call last):
  File "run.py", line 1, in <module>
    from pingadmin import app
  File "/Users/jh321296/python/pingadmin/pingadmin.py", line 44, in <module>
    from SvrConfClusterManager import SvrConfClusterManager
  File "/Users/jh321296/python/pingadmin/SvrConfClusterManager.py", line 3, in <module>
    from cassandra.cluster import Cluster
  File "cassandra/cluster.py", line 46, in init cassandra.cluster

  File "cassandra/connection.py", line 38, in init cassandra.connection
ImportError: No module named queue

I've been reading various things on the web and it seems like this is because the apple installed version of the library "six" is 1.4.1 and the queue module isn't added until sometime later.  However the Apple version of six apparently can't be removed, I suspect it may be used by OSX or something like that.

What is the way to install your driver given this situation?  I'm a sort of new python programmer so I'm not clear on what the right approach is, I'd love to hear about proper installation and use of your drive for OSX if the driver is still in current use.  Thanks!!!

--j

Jack Lista

unread,
Jan 9, 2018, 6:12:05 PM1/9/18
to DataStax Python Driver for Apache Cassandra User Mailing List
I should add I used this command to install the cassandra driver and this may be part of the problem, but this was recommended by someone and it worked for the pip install but it looks like it's the wrong version for the queue module that's already installed so I suspect this isn't the right way to install:

sudo -H pip install cassandra-driver --ignore-installed six

The article I read said this can by check with this command:

python -c 'import cassandra; print cassandra.__version__'

I get this in response:

3.12.0

However, this is the version of the cassandra driver, correct?  So should I conclude that the driver is using the wrong version of six?  It seems so... can you help?  Thanks!

Alan Boudreault

unread,
Jan 10, 2018, 8:42:17 AM1/10/18
to python-dr...@lists.datastax.com
Hello Jack,

I'd recommend to use a virtualenv and not install the driver on the system. That way, you have a better control on the dependencies and it doesn't affect the system at all. So installing the driver with a virtualenv would look like:

virtualenv venv
source venv/bin/activate
pip install cassandra-driver

Then, you will get the latest version of the driver with the proper six version installed.


Alan


--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.



--

Alan Boudreault
Software Engineer (Drivers) | alan.bo...@datastax.com


Jack Lista

unread,
Jan 10, 2018, 1:17:23 PM1/10/18
to python-dr...@lists.datastax.com, Jack Lista
Hi,

Thanks so much for the reply, I was wondering whether virtualenv was the right thing to do, but I'm a bit of a n00b with python so I wasn't sure. 

Does this mean that I'm going to create a new environment and into that environment install a new copy of python along with a more updated six module?  And the docs seem to be at that link you sent me, thank you sir, appreciate it...

-=j=-

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsubscribe@lists.datastax.com.



--

Alan Boudreault
Software Engineer (Drivers) | alan.bo...@datastax.com


Alan Boudreault

unread,
Jan 10, 2018, 1:29:11 PM1/10/18
to python-dr...@lists.datastax.com
In fact, a virtualenv will use the python you already have on your system (unless you specify another one installed somewhere else) and simply create the environment around it. It does not fully copy a new version of the whole python binaries and standard libraries. However, that's the only thing the environment share with the system. It will be empty (with only the standard libs) and everything you install will be available only in that env. So your package six wont be in conflict anymore with the system one.

Alan

To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsubscribe@lists.datastax.com.

--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.
Reply all
Reply to author
Forward
0 new messages