Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python wrapper build unsuccessful #353

Closed
1 of 2 tasks
ctongfei opened this issue Feb 28, 2018 · 3 comments
Closed
1 of 2 tasks

Python wrapper build unsuccessful #353

ctongfei opened this issue Feb 28, 2018 · 3 comments
Labels

Comments

@ctongfei
Copy link

ctongfei commented Feb 28, 2018

Summary

Platform

OS: Linux version 3.16.0-4-amd64 ([email protected]) (gcc version 4.8.4 (Debian 4.8.4-1) ) #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03)

Faiss version: a280791

Faiss compilation options: OpenBLAS

Running on :

  • CPU
  • GPU

Reproduction instructions

make py exited with no error. However loading it in Python creates error.

 /e/b/t/l/faiss   master *…  python -c "import faiss"                                                                                     3.1m  Tue 27 Feb 2018 10:32:47 PM EST
Failed to load GPU Faiss: No module named 'swigfaiss_gpu'
Faiss falling back to CPU-only.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/export/b01/tongfei/lib/faiss/faiss.py", line 248, in <module>
    if inspect.isclass(obj):
  File "/home/tongfei/app/anaconda/lib/python3.6/inspect.py", line 79, in isclass
    return isinstance(object, type)
NameError: Unknown C global variable
 !  /e/b/t/l/faiss   master *…  ldd -r _swigfaiss.so                                                                                    308ms  Tue 27 Feb 2018 10:32:55 PM EST
	linux-vdso.so.1 (0x00007ffe9d3bc000)
	libopenblas.so.0 => /export/b01/tongfei/lib/OpenBLAS/lib/libopenblas.so.0 (0x00007ff468212000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff467f07000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff467c06000)
	libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007ff4679f0000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff4677da000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff4675bd000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff467212000)
	libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007ff466ef4000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff469574000)
	libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007ff466cb7000)
undefined symbol: PyExc_ValueError	(./_swigfaiss.so)
undefined symbol: PyExc_IndexError	(./_swigfaiss.so)
undefined symbol: PyExc_SyntaxError	(./_swigfaiss.so)
undefined symbol: PyCapsule_Type	(./_swigfaiss.so)
undefined symbol: _Py_NoneStruct	(./_swigfaiss.so)
undefined symbol: PyExc_AttributeError	(./_swigfaiss.so)
undefined symbol: PyExc_IOError	(./_swigfaiss.so)
undefined symbol: PyExc_MemoryError	(./_swigfaiss.so)
undefined symbol: PyType_Type	(./_swigfaiss.so)
undefined symbol: PyExc_OverflowError	(./_swigfaiss.so)
undefined symbol: PyExc_NameError	(./_swigfaiss.so)
undefined symbol: PyExc_ZeroDivisionError	(./_swigfaiss.so)
undefined symbol: PyExc_NotImplementedError	(./_swigfaiss.so)
undefined symbol: PyExc_RuntimeError	(./_swigfaiss.so)
undefined symbol: _Py_NotImplementedStruct	(./_swigfaiss.so)
undefined symbol: PyBaseObject_Type	(./_swigfaiss.so)
undefined symbol: PyExc_TypeError	(./_swigfaiss.so)
undefined symbol: PyObject_GenericGetAttr	(./_swigfaiss.so)
undefined symbol: PyFloat_Type	(./_swigfaiss.so)
undefined symbol: PyExc_SystemError	(./_swigfaiss.so)
undefined symbol: PyExc_ImportError	(./_swigfaiss.so)
undefined symbol: PyTuple_SetItem	(./_swigfaiss.so)
undefined symbol: PyLong_AsLong	(./_swigfaiss.so)
undefined symbol: PyObject_GetAttr	(./_swigfaiss.so)
undefined symbol: PyImport_AddModule	(./_swigfaiss.so)
undefined symbol: PyObject_Call	(./_swigfaiss.so)
undefined symbol: PyObject_Init	(./_swigfaiss.so)
undefined symbol: PyInstanceMethod_New	(./_swigfaiss.so)
undefined symbol: PyObject_GetAttrString	(./_swigfaiss.so)
undefined symbol: PyType_IsSubtype	(./_swigfaiss.so)
undefined symbol: PyModule_GetDict	(./_swigfaiss.so)
undefined symbol: PyModule_AddObject	(./_swigfaiss.so)
undefined symbol: PyUnicode_InternFromString	(./_swigfaiss.so)
undefined symbol: PyTuple_New	(./_swigfaiss.so)
undefined symbol: PyObject_SetAttr	(./_swigfaiss.so)
undefined symbol: PyObject_IsInstance	(./_swigfaiss.so)
undefined symbol: PyEval_RestoreThread	(./_swigfaiss.so)
undefined symbol: PyDict_SetItemString	(./_swigfaiss.so)
undefined symbol: PyUnicode_FromFormat	(./_swigfaiss.so)
undefined symbol: _PyObject_New	(./_swigfaiss.so)
undefined symbol: PyErr_Format	(./_swigfaiss.so)
undefined symbol: PyFloat_FromDouble	(./_swigfaiss.so)
undefined symbol: PyFloat_AsDouble	(./_swigfaiss.so)
undefined symbol: PyImport_ImportModule	(./_swigfaiss.so)
undefined symbol: PyUnicode_FromString	(./_swigfaiss.so)
undefined symbol: PyErr_Clear	(./_swigfaiss.so)
undefined symbol: Py_DecRef	(./_swigfaiss.so)
undefined symbol: PyCapsule_Import	(./_swigfaiss.so)
undefined symbol: PyLong_FromVoidPtr	(./_swigfaiss.so)
undefined symbol: PyErr_SetString	(./_swigfaiss.so)
undefined symbol: PyCapsule_New	(./_swigfaiss.so)
undefined symbol: PyArg_ParseTuple	(./_swigfaiss.so)
undefined symbol: PyCapsule_GetPointer	(./_swigfaiss.so)
undefined symbol: PyObject_Free	(./_swigfaiss.so)
undefined symbol: PyType_Ready	(./_swigfaiss.so)
undefined symbol: PyObject_Size	(./_swigfaiss.so)
undefined symbol: PyEval_SaveThread	(./_swigfaiss.so)
undefined symbol: PyLong_FromLong	(./_swigfaiss.so)
undefined symbol: PyObject_IsTrue	(./_swigfaiss.so)
undefined symbol: PyModule_Create2	(./_swigfaiss.so)
undefined symbol: PyLong_AsUnsignedLong	(./_swigfaiss.so)
undefined symbol: PyErr_Occurred	(./_swigfaiss.so)
undefined symbol: PyObject_CallFunctionObjArgs	(./_swigfaiss.so)
undefined symbol: PyLong_FromUnsignedLong	(./_swigfaiss.so)
undefined symbol: PyArg_UnpackTuple	(./_swigfaiss.so)
undefined symbol: PyObject_Malloc	(./_swigfaiss.so)
undefined symbol: PyErr_Print	(./_swigfaiss.so)
undefined symbol: PyUnicode_Concat	(./_swigfaiss.so)
undefined symbol: PyUnicode_AsUTF8String	(./_swigfaiss.so)
undefined symbol: PyUnicode_FromStringAndSize	(./_swigfaiss.so)
undefined symbol: PyBytes_AsStringAndSize	(./_swigfaiss.so)
undefined symbol: PyBool_FromLong	(./_swigfaiss.so)
@mdouze mdouze added the install label Feb 28, 2018
@ctongfei
Copy link
Author

ctongfei commented Feb 28, 2018

Update:
I updated SWIG to 3.0.* from 2.0.*.

Now python -c "import faiss" works. But running

faiss.Kmeans(10, 20).train(numpy.random.rand(1000, 10).astype('float32'))

fails (no output, return value != 0).

ldd -r produces the same result (undefined symbols).

@ctongfei
Copy link
Author

ctongfei commented Feb 28, 2018

Fixed. problem with OpenBLAS with LD_LIBRARY_PATH.

@yongrl
Copy link

yongrl commented Sep 19, 2019

hi, @ctongfei, I met this problem , would you please explain how to solved it with OpenBLAS with LD_LIBRARY_PATH, Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants