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

faiss fails to import on python==3.10.15 #3943

Open
2 of 4 tasks
yangcong356 opened this issue Oct 12, 2024 · 8 comments
Open
2 of 4 tasks

faiss fails to import on python==3.10.15 #3943

yangcong356 opened this issue Oct 12, 2024 · 8 comments

Comments

@yangcong356
Copy link

Summary

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/__init__.py", line 16, in <module>
    from .loader import *
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/loader.py", line 134, in <module>
    from .swigfaiss import *
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/swigfaiss.py", line 13, in <module>
    from . import _swigfaiss
ImportError: /data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/../../../libfaiss.so: undefined symbol: __libc_single_threaded

Platform

OS: Ubuntu 20.04.6 LTS

Faiss version: 1.9.0

Installed from: anaconda

Faiss compilation options:

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

import faiss
@KirinZzzz
Copy link

me too

@KirinZzzz
Copy link

I install faiss using: conda install pytorch::faiss-gpu and encounter the same error

@mnorris11
Copy link

mnorris11 commented Oct 14, 2024

Hi, for me to sanity check, can you paste the steps you used to install?

Following https://github.com/facebookresearch/faiss/wiki/Installing-Faiss, I didn't see the issue, but my conda env is already set up.

I tried also:

conda install conda-forge::faiss
python
>>> import faiss 

without errors

@yangcong356
Copy link
Author

@mnorris11
Thank you so much for answering my question!

I followed your installation method and was able to import the "faiss" package successfully. However, when I run the program, I get an error that there is no "StandardGpuResources" module.

Subsequently, I was using the "conda install pytorch::faiss-gpu" command to install the faiss-gpu version, and when I imported the faiss package, I had the following problem:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/__init__.py", line 16, in <module>
    from .loader import *
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/loader.py", line 134, in <module>
    from .swigfaiss import *
  File "/data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/swigfaiss.py", line 13, in <module>
    from . import _swigfaiss
ImportError: /data1/users/yangcong/miniconda3/envs/ccvit/lib/python3.10/site-packages/faiss/../../../libfaiss.so: undefined symbol: __libc_single_threaded

@mnorris11
Copy link

I tried these steps and could not reproduce with a fresh conda env:

$ conda create -n faiss_3943

$ conda update -y -n base -c defaults conda

$ conda activate faiss_3943

$ conda install -y -q python=3.11 cmake make swig mkl=2023 mkl-devel=2023 numpy scipy pytest gxx_linux-64=11.2 sysroot_linux-64 gflags

$ conda install pytorch::faiss-gpu

$ python
Python 3.11.10 (main, Oct  3 2024, 07:29:13) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import faiss
>>> 

This is on CentOS. This does not work for you?

@lichenmao
Copy link

@mnorris11
Thanks, I followed your steps, but I still meet the following problems.
Driver Version: 525.147.05 CUDA Version: 12.0

>>> import faiss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/chimao/anaconda3/envs/fgpu/lib/python3.11/site-packages/faiss/__init__.py", line 16, in <module>
    from .loader import *
  File "/home/chimao/anaconda3/envs/fgpu/lib/python3.11/site-packages/faiss/loader.py", line 134, in <module>
    from .swigfaiss import *
  File "/home/chimao/anaconda3/envs/fgpu/lib/python3.11/site-packages/faiss/swigfaiss.py", line 13, in <module>
    from . import _swigfaiss
ImportError: /home/chimao/anaconda3/envs/fgpu/lib/python3.11/site-packages/faiss/../../../libfaiss.so: undefined symbol: __libc_single_threaded


@mnorris11
Copy link

Can you paste your conda list -n fgpu and ldd --version? We can check the some versions.

@mnorris11
Copy link

FYI there is also this ongoing issue: #3925 (comment)

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

No branches or pull requests

5 participants