Trouble verifying installation of cassandra driver 3.8.1

13 views
Skip to first unread message

Billy Mack

unread,
Mar 27, 2017, 6:46:09 PM3/27/17
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi.. I'm a newbie to both python and apache cassandra:

Trying to follow the installation instructions from http://datastax.github.io/python-driver/installation.html

I recieve a syntax error at the verification step (trying to print the version number).

This is confusing to me because the installation claimed to be successful.

Perhaps I am making a very simple mistake.. I tried a few permutations of the instruction as seen in the attached screen shot.

Any insight is much appreciated,

Thanks.
verifyCassandraPythonDriver.png

Alex Baeza

unread,
Mar 27, 2017, 6:59:52 PM3/27/17
to python-dr...@lists.datastax.com
Your issue is you are using python3 with instructions for python2

python 3 has a different print statement.

You have to change (python2):
python -c ‘import cassandra; print cassandra.__version__’
To python3 syntax:
python -c 'import cassandra; print(cassandra.__version__)’

Breakdown:

python -c
This part tell python to use the following command (as specified by the quoted string that follows -c).
quoted string (part 1) ‘import cassandra;
The first part of the quoted string tells python to import the cassandra library you just installed, the semicolon allows you to specify
more than one command on the same line.
quoted string (part 2) print(cassandra.__version__)’
In cassandra 3 your print statements need parenthesis around the thing you want to print. In version 2 you didn’t need this, which is
why your example was failing.

Make sure you are aware of which version of python you are using for your various development projects.

Take a look at venv https://docs.python.org/3/library/venv.html. This allows you to create different sandboxes to work in, so that some
environments can have different packages installed. For example you may want to write a program for Cassandra in one env and
write another program that has nothing to do with cassandra in a different env.


--
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.
<verifyCassandraPythonDriver.png>

Billy Mack

unread,
Mar 27, 2017, 7:45:06 PM3/27/17
to DataStax Python Driver for Apache Cassandra User Mailing List
Thank you for the assistance and link; very helpful! 
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.
<verifyCassandraPythonDriver.png>

Reply all
Reply to author
Forward
0 new messages