Python client example not works at centos 7


What i have

  1. running aerospike, test sql go okay

  2. installed client lib on same machine via pip3 install aerospike

  3. python version default for centos 7

Python 3.4.9

Sample for this page is not working

After i removed try/except block, i get following error:

Traceback (most recent call last):
  File "/tmp/", line 4, in <module>
    import aerospike
  File "/tmp/", line 12, in <module>
    client = aerospike.client(config).connect()
AttributeError: 'module' object has no attribute 'client'

I not see source code of connector(cpython used?) and have no any clue where to go from this point.


Can you show us the full code you ran?


It is exactly as python sample.

# import the module
from __future__ import print_function
import aerospike

# Configure the client
config = {
  'hosts': [ ('', 3000) ]

# Create a client and connect it to the cluster
client = aerospike.client(config).connect()


It looks like Python is loading your file as the aerospike module instead of the Aerospike client library.

I suggest renaming your file to something other than and running the example again. Also make sure that there isn’t an aerospike.pyc file that is in the directory, or a corresponding entry in the __pycache__ directory

If that doesn’t work could you try running: pip3 freeze and seeing if that contains an entry for aerospike?


Yes, you are right. Thank you.

Now i have problem with scan example not work with python3, but i think i can live without.


The error might be that the callback in the example uses a syntax removed in Python 3:

def print_result((key, metadata, record)):
    print(key, metadata, record)

You could change this to:

def print_result(record_tuple):


Sure, i already did that. But it give error about “callback raises exception” and seams like not say which exception.


Is the callback just a function which prints the data?

If not I would suggest wrapping the call in a try/except and printing the caught exception.


Thank you for support, i will do when next time return to that issue.

Upto moment all works great, 10times less load if compare with cassandra. Only problem we have - no easy way do insert/no odbc driver, but we can live with that.