3

I was trying to import aerospike after downloading it using pip and I am getting this error. I tried reinstalling the python using homebrew and graphical installer but the result is the same. I am able to import other packages such as numpy.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/aerospike.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/lib/python3.7/site-packages/aerospike.cpython-37m-darwin.so
  Reason: image not found
Christian
  • 1,162
  • 12
  • 21

3 Answers3

7

on OSX Catalina there are some issues with the default openssl install. Please follow these steps.

brew update && brew upgrade
brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

More details here - https://github.com/kelaberetiv/TagUI/issues/86

Pradeep Banavara
  • 983
  • 2
  • 11
  • 33
6

The Aerospike python client is most likely failing on import because of a missing openssl dependency.

I would recommend installing openssl

brew install openssl

Then reinstalling the python client with.

pip install aerospike --force-reinstall

Otherwise you can follow the OSX build instructions here. https://github.com/aerospike/aerospike-client-python/blob/master/BUILD.md#os-x

Hope this helps.

D.W
  • 101
  • 4
2

This worked for me - it's a combination of the solutions written before me (but since we had other things dependent on SSL 1.1.1, we couldn't uninstall it).

# install latest version of OpenSSL if not already exist
brew install openssl

# install Aerospike client
pip3 install aerospike

# if aerospike does not import, then install an older version of OpenSSL - 1.0.2t
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

This will alert that:

Warning: openssl 1.1.1f is available and more recent than version 1.0.2t.  

but that is fine since we need an older version in order to use Aerospike.

Then, we can use brew to set it to the older OpenSSL version:

# switch to the older OpenSSL version we installed
brew switch openssl 1.0.2t

Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t

This worked for Python 3.7.7 and OS X 10.14.6

P.S:
in some cases this worked, without needing to install OpenSSL 1.0.2t so you might want to try those as well:

# switch to older OpenSSL in 10.14
brew switch openssl 1.0.2s

# switch to older OpenSSL in 10.15
brew switch openssl 1.0.2q
Zohar Elkayam
  • 198
  • 1
  • 5