hnswlib icon indicating copy to clipboard operation
hnswlib copied to clipboard

cannot import binding error

Open jth3galv opened this issue 2 years ago • 3 comments

I have tried installing with pip and from source (even recompiling)

C code compile and works but I cannot import hnswlib library in python (3.9). I get:

ImportError: /home/giulio/anaconda3/lib/python3.9/site-packages/hnswlib.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv

jth3galv avatar May 20 '23 15:05 jth3galv

I looks like a conda environment issue, this is discussed https://github.com/pybind/pybind11/issues/3623

yurymalkov avatar May 26 '23 15:05 yurymalkov

I had the same issue with Python 3.7.4 in Ubuntu 22.04. I tried both pip install hnswlib, and pip install . from source code. I also tried older version 0.6.2, 0.5.1, 0.4.0. The error is "undefined symbol: _ZNSt15__exception_ptr13exception_ptr10_M_releaseEv"

I looked at https://github.com/pybind/pybind11/issues/3623, the solution is to use G++ 9 or 10, but your code requires a C++ 11.0.

I tried conda install -c conda-forge hnswlib on different versions, the error becomes "CondaValueError: Malformed version string '~': invalid character(s)."

wjtan99 avatar Nov 10 '23 17:11 wjtan99

i have same issue,solved by: export LD_PRELOAD=/your path/hnswlib.xxx.so:

AlexYoung757 avatar Apr 11 '24 01:04 AlexYoung757