Faiss: undefined symbol: PyCObject_Type

Created on 4 Oct 2018  路  6Comments  路  Source: facebookresearch/faiss

Hi, the following error has been arised when I run the command python -c "import faiss" . Could you give me some suggestions?

 Failed to load GPU Faiss: /mnt/disk-c/mark/faiss-2/faiss/python/_swigfaiss_gpu.so: undefined symbol: PyCObject_Type
Faiss falling back to CPU-only.
Traceback (most recent call last):
  File "/mnt/disk-c/mark/faiss-2/faiss/python/faiss/swigfaiss_gpu.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/home/mark/Python-3.6.4/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /mnt/disk-c/mark/faiss-2/faiss/python/faiss/_swigfaiss_gpu.so: undefined symbol: PyCObject_Type
During handling of the above exception, another exception occurred: 
install

Most helpful comment

I had the same error. I discovered that while PYTHONFLAGS were pointing to 2.7, python on my system defaulted at the time to anaconda's python3.6. You could check for that consistency.

All 6 comments

Did you compile faiss yourself? If so, could you share your makefile.inc?

Yes, this is my makefile.inc, makefile.inc.txt.

I had the same error. I discovered that while PYTHONFLAGS were pointing to 2.7, python on my system defaulted at the time to anaconda's python3.6. You could check for that consistency.

Thank you for your help. I'll check it.

No activity. Closing.

I encountered this problem, but it turned out I had run configure with the following environment variables set:

CFLAGS=-I/usr/include/python2.7
CXXFLAGS=-I/usr/include/python2.7

The fix was instead to use the corresponding python3 paths and to specify the option --with-python=python3, when running configure.

Was this page helpful?
0 / 5 - 0 ratings