'Unable to run Aerospike python client on MAC with M1 chip
Hi I am trying to setup my local dev environment. I have installed aerospike==5.0.0. But I am unable to import it due to x86_64 architecture not being supported.
In [1]: import aerospike
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-d60dd2d8373f> in <module>
----> 1 import aerospike
ImportError: dlopen(/Users/mudit/.virtualenvs/payments/lib/python3.9/site-packages/aerospike.cpython-39-darwin.so, 0x0002): tried: '/Users/mudit/.virtualenvs/payments/lib/python3.9/site-packages/aerospike.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/aerospike.cpython-39-darwin.so' (no such file), '/usr/lib/aerospike.cpython-39-darwin.so' (no such file)
If I downgrade the python version to 3.7 I am unable to install aerospike getting following error:
pip install aerospike==5.0.0
Collecting aerospike==5.0.0
Using cached aerospike-5.0.0.tar.gz (182 kB)
ERROR: Command errored out with exit status 1:
command: /Users/mudit/.pyenv/versions/3.7.10/envs/myenv/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d3/p7j4w0dx1d56h05_2pwpf4q80000gp/T/pip-install-c0ra2cak/aerospike/setup.py'"'"'; __file__='"'"'/private/var/folders/d3/p7j4w0dx1d56h05_2pwpf4q80000gp/T/pip-install-c0ra2cak/aerospike/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/d3/p7j4w0dx1d56h05_2pwpf4q80000gp/T/pip-pip-egg-info-zqg4d0y6
cwd: /private/var/folders/d3/p7j4w0dx1d56h05_2pwpf4q80000gp/T/pip-install-c0ra2cak/aerospike/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/mudit/.pyenv/versions/3.7.10/envs/myenv/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/Users/mudit/.pyenv/versions/3.7.10/envs/myenv/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/Users/mudit/.pyenv/versions/3.7.10/envs/myenv/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/Users/mudit/.pyenv/versions/3.7.10/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I have even tried running my project on docker but still the aerospike installation is failing.
12 4.293 info: Executing ./scripts/aerospike-client-c.sh
#12 4.293 info: downloading 'https://artifacts.aerospike.com/aerospike-client-c/5.2.0/aerospike-client-c-devel-5.2.0.debian11.x86_64.deb' to '/tmp/pip-install-ydkcep01/aerospike/aerospike-client-c/package/aerospike-client-c-devel-5.2.0.debian11.x86_64.deb'
#12 4.293 % Total % Received % Xferd Average Speed Time Time Time Current
#12 4.293 Dload Upload Total Spent Left Speed
100 2163 100 2163 0 0 3814 0 --:--:-- --:--:-- --:--:-- 3814
#12 4.293 info: extracting files from 'aerospike-client-c-devel-5.2.0.debian11.x86_64.deb'
#12 4.293 dpkg-deb: error: 'aerospike-client-c-devel-5.2.0.debian11.x86_64.deb' is not a Debian format archive
#12 4.293
#12 4.293 CHECK
#12 4.293 [✗] /tmp/pip-install-ydkcep01/aerospike/aerospike-client-c/package/usr/lib/libaerospike.a
#12 4.293 [✗] /tmp/pip-install-ydkcep01/aerospike/aerospike-client-c/package/usr/include/aerospike/aerospike.h
#12 4.293
#12 4.293 error: scripts/aerospike-client-c.sh 1
Can Somebody pls suggest a way to successfully import aerospike python client on MacOs Monterey with M1 chip?
Solution 1:[1]
If you use KubeLab you can run Intel (x86_64, amd64) Docker images on Apple M1 processors. https://github.com/aerospike-community/docker-amd64-mac-m1
There are instructions for how to run the Aerospike server image with this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ronen Botzer |