Reputation: 113
When importing datastax cassandra-driver(python) get the following error
Error
File "cassandra.py", line 1, in <module>
from cassandra.cluster import Cluster
File "/home/vagrant/cassandra.py", line 1, in <module>
from cassandra.cluster import Cluster
ImportError: No module named cluster
This is the code
from cassandra.cluster import Cluster
print dir(cassandra.cluster)
cluster = Cluster()
session = cluster.connect('userspace')
rows = session.execute('SELECT user_name, gender FROM users')
for user_row in rows:
print user_row.user_name, user_row.gender
Upvotes: 11
Views: 13171
Reputation: 53
I tried this and it worked in my case: python -m pip install `
for example: python -m pip install cassandra-driver
Upvotes: 0
Reputation: 3374
Well, it looks like names conflict. Your script is cassandra.py
and so it is the module for the driver. Try to rename your script (and don't forget to delete its .pyc
) and try again
Upvotes: 20