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 installation issues in conda env #254

Open
felixsh opened this issue Aug 8, 2024 · 5 comments
Open

faiss installation issues in conda env #254

felixsh opened this issue Aug 8, 2024 · 5 comments

Comments

@felixsh
Copy link

felixsh commented Aug 8, 2024

I'm trying to install OpenOOD in a conda environment per yaml file, like so:

name: env
channels:
  - pytorch
  - nvidia
  - defaults
dependencies:
  - python=3.12
  - numpy
  - matplotlib
  - scikit-learn
  - scipy
  - tqdm
  - pytorch:pytorch
  - pytorch:torchvision
  - nvidia:pytorch-cuda=12.1
  - pytorch::faiss-gpu
  - cython
  - pip
  - pip:
    - git+https://github.com/Jingkang50/OpenOOD

Building with conda env create --file=env.yaml throws an error saying faiss-gpu>=1.7.2 can not be satisfied.
Changing this to faiss>=1.7.2 in setup.py resolves the issue.

The problem is probably somewhere between pip and conda.
On inspection conda list | grep faiss --> faiss-gpu, but pip list | grep faiss --> faiss and pip can not find the faiss-gpu package.

Not sure if this needs fixing or is a packaging issue with conda, either way the trinity of faiss, faiss-cpu, faiss-gpu is confusing. Maybe this helps somebody else trying to install OpenOOD in a conda env.

@zjysteven
Copy link
Collaborator

Thanks for sharing this. Just curious, what about removing pytorch::faiss-gpu in conda dependencies and just let pip alone to handle faiss installation?

@felixsh
Copy link
Author

felixsh commented Aug 9, 2024

Letting pip handle the dependencies results in an error:

ERROR: Could not find a version that satisfies the requirement faiss-gpu>=1.7.2 (from openood) (from versions: none)
ERROR: No matching distribution found for faiss-gpu>=1.7.2

Installing with pip in python3.11 (no conda) produces a similar error. I guess the installation via pip is not intended, to quote the faiss-installation guide: "The supported way to install Faiss is through conda."

@zjysteven
Copy link
Collaborator

Right, turned out that the pypi package expects python >=3.7, <3.11. With as late as python 3.10 the pip installation still works but not with 3.11.
image

@felixsh
Copy link
Author

felixsh commented Aug 10, 2024

Thanks for the clarification! So, I just missed the correct version.

I will stick with python 3.12 and the solution above for now, that seems to work just fine. From my side this can be closed, only suggestion I have to maybe add this as a note under the installation section.

@Tankiit
Copy link

Tankiit commented Nov 22, 2024

This was also bugging me and the above solution works in MPS now. So anyone struggling in Mac just remove the fails-gpu to cpu and hopefully this should go through.

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

No branches or pull requests

3 participants