0

I've run through the installation commands on my centos7 machine and installed aerospike.


[ra222c@webphp-wcklssk]~% sudo pip install aerospike
WARNING: The directory '/csnzoo/ra222c/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/csnzoo/ra222c/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting aerospike
  Downloading https://files.pythonhosted.org/packages/0d/ac/4f07557a897aad86b4583916eb17a46a9963d9e64901cd3c92f38781ba11/aerospike-3.9.0-cp34-cp34m-manylinux2010_x86_64.whl (3.9MB)
     |████████████████████████████████| 3.9MB 22.3MB/s 
Installing collected packages: aerospike
Successfully installed aerospike-3.9.0
[ra222c@webphp-wcklssk]~% python                    
Python 2.7.5 (default, Apr  9 2019, 14:30:50) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named aerospike
>>> 
[ra222c@webphp-wcklssk]~% sudo pip3 install aerospike
WARNING: The directory '/csnzoo/ra222c/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/csnzoo/ra222c/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: aerospike in /usr/lib64/python3.4/site-packages (3.9.0)
[ra222c@webphp-wcklssk]~% python3
Python 3.6.0 (default, Jan 19 2017, 16:59:54) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'aerospike'
>>> 

As you can see above, the module is not found in either python 2 or 3.

Any insight greatly appreciated. TIA.

UPDATE: Using suggested anser of sudo python3 -m pip install aerospike results in the following.

creating build/temp.linux-x86_64-3.6/src/main/cdt_types
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isrc/include -I/usr/local/opt/openssl/include -I./aerospike-client-c/include -I./aerospike-client-c/include/ck -I/usr/include/python3.6m -c src/main/aerospike.c -o build/temp.linux-x86_64-3.6/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
src/main/aerospike.c:17:20: fatal error: Python.h: No such file or directory
 #include <Python.h>
                    ^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ucv2j8au/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-9i6gixuj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ucv2j8au/aerospike/
Ramy
  • 20,541
  • 41
  • 103
  • 153
  • why using pip with sudo , read warning maybe try `sudo -H pip install aerospike --user` – sahasrara62 Dec 12 '19 at 21:32
  • Stop using `sudo` with `pip install` as those could interfere with system site-packages. Use `pip install --user` or better, look into virtual environments. – Gino Mempin Dec 13 '19 at 09:31

1 Answers1

0

I looked a bit closer at the output of the errors I was getting. It looks like aerospike is expecting python3.4. I'm also running python3.6 (as the default python3). running the interactive shell with python3.4 took care of this:

[ra222c@webphp-wcklssk]~% python3.4
Python 3.4.10 (default, Oct  4 2019, 19:14:13) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aerospike
>>> 
Ramy
  • 20,541
  • 41
  • 103
  • 153
  • 1
    it idscompactible with python 3.6 https://pypi.org/project/aerospike/ – sahasrara62 Dec 12 '19 at 21:49
  • ya but i installed the one that is for 3.6. so there are two solutions: use the right version of python or install the right version of aerospike. – Ramy Dec 13 '19 at 21:22