Aerospike Python Client 2.0: Support for Python 3

Posted on March 7, 2016

Written by Jeff Boone (@jboone100), Sr. Engineer at Aerospike

The 2.0 version of the Aerospike Python client is a major release: it adds support for Python 3. Therefore, the client software is now compatible with Python versions 2.6, 2.7, 3.4 and 3.5. For those of you migrating your application from Python 2 to Python 3, there are a few key differences between the two versions to keep in mind as you work through porting the software to the next version.

Please click here for the full text of the blog post.

Because of the non-backward compatible python and python3 issues, I am typically installing python2 as ‘python’ and python3 as ‘python3’. I am not using ‘virtualenv’ but I do have pip3 installed.

When I run ‘pip3 install aerospike’ ( as root ) I get the following:

… … … … 100% 7.76M=9.7s\n\n2017-01-13 06:41:24 (4.29 MB/s) - ‘/tmp/pip-build-20woxx5v/aerospike/aerospike-client-c/package/aerospike-client-c.tgz’ saved [43564522/43564522]\n\ninfo: extracting ‘aerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-libev-devel-4.1.1.debian7.x86_64.deb\naerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-devel-4.1.1.debian7.x86_64.deb\naerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-libuv-devel-4.1.1.debian7.x86_64.deb’ from ‘aerospike-client-c.tgz’\ninfo: extracting files from ‘aerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-libev-devel-4.1.1.debian7.x86_64.deb\naerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-devel-4.1.1.debian7.x86_64.deb\naerospike-client-c-4.1.1.debian7.x86_64/aerospike-client-c-libuv-devel-4.1.1.debian7.x86_64.deb’\n\nCHECK\n [\u2713] /tmp/pip-build-20woxx5v/aerospike/aerospike-client-c/package/usr/lib/libaerospike.a\n [\u2713] /tmp/pip-build-20woxx5v/aerospike/aerospike-client-c/package/usr/include/aerospike/aerospike.h\n [\u2713] /tmp/pip-build-20woxx5v/aerospike/aerospike-client-c/package/opt/aerospike/client/sys/udf/lua/aerospike.lua\n\ninfo: aerospike.h found: ./aerospike-client-c/include/aerospike/aerospike.h\ninfo: libaerospike.a found: ./aerospike-client-c/lib/libaerospike.a\ncopying from aerospike-client-c/lua to /usr/local/aerospike/lua\nrunning install\nrunning build\nrunning build_ext\nbuilding ‘aerospike’ extension\ncreating build\ncreating build/temp.linux-x86_64-3.4\ncreating build/temp.linux-x86_64-3.4/src\ncreating build/temp.linux-x86_64-3.4/src/main\ncreating build/temp.linux-x86_64-3.4/src/main/client\ncreating build/temp.linux-x86_64-3.4/src/main/query\ncreating build/temp.linux-x86_64-3.4/src/main/scan\ncreating build/temp.linux-x86_64-3.4/src/main/llist\ncreating build/temp.linux-x86_64-3.4/src/main/geospatial\ncreating build/temp.linux-x86_64-3.4/src/main/global_hosts\ncreating build/temp.linux-x86_64-3.4/src/main/nullobject\nx86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Isrc/include -I/usr/local/opt/openssl/include -I./aerospike-client-c/include -I./aerospike-client-c/include/ck -I/usr/include/python3.4m -c src/main/aerospike.c -o build/temp.linux-x86_64-3.4/src/main/aerospike.o -std=gnu99 -g -Wall -fPIC -O1 -fno-common -fno-strict-aliasing -Wno-strict-prototypes -march=nocona -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_GNU_SOURCE -rdynamic -finline-functions -DMARCH_x86_64\nsrc/main/aerospike.c:17:20: fatal error: Python.h: No such file or directory\n #include <Python.h>\n ^\ncompilation terminated.\nerror: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1\n\n----------------------------------------" Arguments: () Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-20woxx5v/aerospike/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-k6qaxumf-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-20woxx5v/aerospike/

Python.h comes from the python-dev package. Use brew, or however you installed python to install the python3-dev package.