Hello,
I am running Transformers on a Mac OS with Python 3.8 in a virtual environment.
I have faiss-cpu 1.7.0 installed in the env.
(venv) sergey_mkrtchyan transformers (master) $ python
Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import faiss
>>> faiss.__version__
'1.7.0'
However transformers repo is doing an additional check of the version of the package using importlib_metadata in transformers/src/file_utils.py
which ends up failing on me with “RagRetriever requires the faiss library but it was not found in your environment.”
_faiss_available = importlib.util.find_spec("faiss") is not None
try:
_faiss_version = importlib_metadata.version("faiss")
logger.debug(f"Successfully imported faiss version {_faiss_version}")
except importlib_metadata.PackageNotFoundError:
_faiss_available = False
This is where it fails, mind you _faiss_available = importlib.util.find_spec("faiss")
line above works just fine, but fails on the _faiss_version = importlib_metadata.version("faiss")
line unable to find the faiss package.
Not sure if it’s an issue in the repo or something wrong on my side. Any experience with this?
Thank you!