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

Fresh Faiss Install does not work #3865

Closed
4 tasks
jakubLangr opened this issue Sep 17, 2024 · 5 comments
Closed
4 tasks

Fresh Faiss Install does not work #3865

jakubLangr opened this issue Sep 17, 2024 · 5 comments

Comments

@jakubLangr
Copy link

jakubLangr commented Sep 17, 2024

Summary

Install does not work despite multiple install methods, fresh conda reinstall, multiple python environments

Platform

Mac OS.X Ventura 13.5.1
Python 3.10 (newer versions did not work)

OS:

Faiss version:

Installed from:
Conda Fresh Reinstall

conda install -c conda-forge faiss-cpu -f


WARNING: The --force flag will be removed in a future conda release.
         See 'conda install --help' for details about the --force-reinstall
         and --clobber flags.


Collecting package metadata (current_repodata.json): \ WARNING conda.models.version:get_matcher(535): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1.*, but conda is ignoring the .* and treating it as 1.7.1
done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.12.0
  latest version: 24.7.1

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /Users/jlangr/opt/anaconda3/envs/b310

  added / updated specs:
    - faiss-cpu



Proceed ([y]/n)?

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Faiss compilation options:

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

python
Python 3.10.14 (main, May  6 2024, 14:47:20) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import faiss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/__init__.py", line 16, in <module>
    from .loader import *
  File "/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/loader.py", line 65, in <module>
    from .swigfaiss import *
  File "/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/swigfaiss.py", line 13, in <module>
    from . import _swigfaiss
ImportError: dlopen(/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/_swigfaiss.so, 0x0002): Library not loaded: @rpath/libmkl_intel_lp64.1.dylib
  Referenced from: <4A025BD7-6F1F-3CD5-B319-DE475BB38238> /Users/jlangr/opt/anaconda3/envs/b310/lib/libfaiss.dylib
  Reason: tried: '/opt/homebrew/lib/libmkl_intel_lp64.1.dylib' (no such file), '/libmkl_intel_lp64.1.dylib' (no such file), '/Users/jlangr/opt/anaconda3/envs/b310/lib/libmkl_intel_lp64.1.dylib' (no such file), '/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/../../../libmkl_intel_lp64.1.dylib' (no such file), '/Users/jlangr/opt/anaconda3/envs/b310/lib/python3.10/site-packages/faiss/../../../libmkl_intel_lp64.1.dylib' (no such file), '/Users/jlangr/opt/anaconda3/envs/b310/bin/../lib/libmkl_intel_lp64.1.dylib' (no such file), '/Users/jlangr/opt/anaconda3/envs/b310/bin/../lib/libmkl_intel_lp64.1.dylib' (no such file), '/usr/local/lib/libmkl_intel_lp64.1.dylib' (no such file), '/usr/lib/libmkl_intel_lp64.1.dylib' (no such file, not in dyld cache)

Other notes

I've tried brew install as well as other conda options to no avail. It seems that it always selects the wrong/Intel version but I'm not 100% sure and GPT/Claude etc. were of no help here as they got stuck.

@mnorris11
Copy link

mnorris11 commented Sep 17, 2024

Hi,

Try this:

  1. Download latest miniconda: https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh (or x86_64 depending on your architecture, the installer will give an warning if it is wrong)
  2. conda remove --name faiss_env --all -y in case there's an existing one
  3. conda create -n faiss_env
  4. conda activate faiss_env
  5. 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
  6. which python3 should print somewhere like miniconda3/bin/python3
  7. conda install -c pytorch faiss-cpu=1.8.0

I did a clean install just now and just running import faiss works:

(faiss_env) mnorris@mnorris-mbp:[~]: python3
Python 3.12.5 | packaged by Anaconda, Inc. | (main, Sep 12 2024, 13:22:57) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import faiss

I am on Mac OSX Sonoma 14.6.1 though.

Copy link

This issue is stale because it has been open for 7 days with no activity.

Copy link

github-actions bot commented Oct 3, 2024

This issue was closed because it has been inactive for 7 days since being marked as stale.

@gustavz
Copy link

gustavz commented Feb 20, 2025

Hi,

Try this:

  1. Download latest miniconda: https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh (or x86_64 depending on your architecture, the installer will give an warning if it is wrong)
  2. conda remove --name faiss_env --all -y in case there's an existing one
  3. conda create -n faiss_env
  4. conda activate faiss_env
  5. 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
  6. which python3 should print somewhere like miniconda3/bin/python3
  7. conda install -c pytorch faiss-cpu=1.8.0

I did a clean install just now and just running import faiss works:

(faiss_env) mnorris@mnorris-mbp:[~]: python3
Python 3.12.5 | packaged by Anaconda, Inc. | (main, Sep 12 2024, 13:22:57) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import faiss

I am on Mac OSX Sonoma 14.6.1 though.

@mnorris11 I had to modify step 5 to
5. conda install -y -q -c conda-forge python=3.11 cmake make swig numpy scipy pytest gflags blas-devel openblas

@gustavz
Copy link

gustavz commented Feb 21, 2025

this is my current playbook to be able to run tests locally:
#4055 (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

3 participants