kyamagu / faiss-wheels

Unofficial faiss wheel builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImportError: DLL load failed: The specified module could not be found.

nithinreddyy opened this issue · comments

ImportError: DLL load failed: The specified module could not be found.

Can anyone help me with this? I've installed with pip install faiss-cpu and python version is 3.7.9

It's running good in colab, but not in local pc

I've installed library using pip install faiss-cpu, but while importing import faiss, it's returning error

ImportError                               Traceback (most recent call last)
<ipython-input-1-5103e2bbb783> in <module>
      8 import matplotlib.pyplot as plt
      9 from pprint import pprint
---> 10 import faiss
     11 from sentence_transformers import SentenceTransformer, util
     12 from transformers import T5Tokenizer, T5ForConditionalGeneration

~\t5\lib\site-packages\faiss\__init__.py in <module>
     16 
     17 # We import * so that the symbol foo can be accessed as faiss.foo.
---> 18 from .loader import *
     19 
     20 

~\t5\lib\site-packages\faiss\loader.py in <module>
     63     # we import * so that the symbol X can be accessed as faiss.X
     64     logger.info("Loading faiss.")
---> 65     from .swigfaiss import *
     66     logger.info("Successfully loaded faiss.")

~\t5\lib\site-packages\faiss\swigfaiss.py in <module>
     11 # Import the low-level C/C++ module
     12 if __package__ or "." in __name__:
---> 13     from . import _swigfaiss
     14 else:
     15     import _swigfaiss

ImportError: DLL load failed: The specified module could not be found.

Please specify

  • OS version
  • faiss-cpu/faiss-gpu version
  • python version

Please specify

  • OS version
  • faiss-cpu/faiss-gpu version
  • python version

The recent fix was running.

pip uninstall faiss-cpu

Re-install new version

pip install faiss-cpu

remove 1.7.1 then install 1.7.2 solve the problem

Still got the problem with version 1.7.2

Microsoft windows 11 Pro
Version 10.0.22000 Build 22000

(base) C:\data\haystack>python --version
Python 3.9.7

(base) C:\data\haystack>pip install faiss-cpu
Collecting faiss-cpu
Using cached faiss_cpu-1.7.2-cp39-cp39-win_amd64.whl (9.9 MB)
Installing collected packages: faiss-cpu
Successfully installed faiss-cpu-1.7.2


ImportError Traceback (most recent call last)
~\anaconda3\lib\site-packages\transformers\file_utils.py in _get_module(self, module_name)
2280 try:
-> 2281 return importlib.import_module("." + module_name, self.name)
2282 except Exception as e:

~\anaconda3\lib\importlib_init_.py in import_module(name, package)
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128

~\anaconda3\lib\importlib_bootstrap.py in _gcd_import(name, package, level)

~\anaconda3\lib\importlib_bootstrap.py in find_and_load(name, import)

~\anaconda3\lib\importlib_bootstrap.py in find_and_load_unlocked(name, import)

~\anaconda3\lib\importlib_bootstrap.py in _load_unlocked(spec)

~\anaconda3\lib\importlib_bootstrap_external.py in exec_module(self, module)

~\anaconda3\lib\importlib_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

~\anaconda3\lib\site-packages\transformers\models\rag\modeling_rag.py in
29 from .configuration_rag import RagConfig
---> 30 from .retrieval_rag import RagRetriever
31

~\anaconda3\lib\site-packages\transformers\models\rag\retrieval_rag.py in
35 if is_faiss_available():
---> 36 import faiss
37

~\anaconda3\lib\site-packages\faiss_init_.py in
50 # We import * so that the symbol foo can be accessed as faiss.foo.
---> 51 from .loader import *
52

~\anaconda3\lib\site-packages\faiss\loader.py in
64 logger.info("Loading faiss.")
---> 65 from .swigfaiss import *
66 logger.info("Successfully loaded faiss.")

~\anaconda3\lib\site-packages\faiss\swigfaiss.py in
12 if package or "." in name:
---> 13 from . import _swigfaiss
14 else:

ImportError: DLL load failed while importing _swigfaiss: The specified module could not be found.

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_28536/3219429723.py in
5 from pathlib import Path
6
----> 7 from haystack.nodes import Text2SparqlRetriever
8 from haystack.document_stores import GraphDBKnowledgeGraph
9 from haystack.utils import fetch_archive_from_http

~\anaconda3\lib\site-packages\haystack_init_.py in
19 logging.getLogger("haystack").setLevel(logging.INFO)
20
---> 21 from haystack import pipelines
22 from haystack.schema import Document, Answer, Label, MultiLabel, Span
23 from haystack.nodes import BaseComponent

~\anaconda3\lib\site-packages\haystack\pipelines_init_.py in
----> 1 from haystack.pipelines.base import Pipeline, RootNode, RayPipeline
2 from haystack.pipelines.standard_pipelines import (
3 BaseStandardPipeline,
4 DocumentSearchPipeline,
5 QuestionGenerationPipeline,

~\anaconda3\lib\site-packages\haystack\pipelines\base.py in
16 from networkx import DiGraph
17 from networkx.drawing.nx_agraph import to_agraph
---> 18 from haystack.nodes.evaluator.evaluator import (
19 calculate_em_str_multi,
20 calculate_f1_str_multi,

~\anaconda3\lib\site-packages\haystack\nodes_init_.py in
4
5 Crawler = safe_import("haystack.nodes.connector.crawler", "Crawler", "crawler") # Has optional dependencies
----> 6 from haystack.nodes.answer_generator import BaseGenerator, RAGenerator, Seq2SeqGenerator
7 from haystack.nodes.document_classifier import BaseDocumentClassifier, TransformersDocumentClassifier
8 from haystack.nodes.evaluator import EvalDocuments, EvalAnswers

~\anaconda3\lib\site-packages\haystack\nodes\answer_generator_init_.py in
1 from haystack.nodes.answer_generator.base import BaseGenerator
----> 2 from haystack.nodes.answer_generator.transformers import RAGenerator, Seq2SeqGenerator

~\anaconda3\lib\site-packages\haystack\nodes\answer_generator\transformers.py in
7 import torch
8 from haystack.modeling.utils import initialize_device_settings
----> 9 from transformers import (
10 RagTokenizer,
11 RagTokenForGeneration,

~\anaconda3\lib\importlib_bootstrap.py in handle_fromlist(module, fromlist, import, recursive)

~\anaconda3\lib\site-packages\transformers\file_utils.py in getattr(self, name)
2270 elif name in self._class_to_module.keys():
2271 module = self._get_module(self._class_to_module[name])
-> 2272 value = getattr(module, name)
2273 else:
2274 raise AttributeError(f"module {self.name} has no attribute {name}")

~\anaconda3\lib\site-packages\transformers\file_utils.py in getattr(self, name)
2269 value = self._get_module(name)
2270 elif name in self._class_to_module.keys():
-> 2271 module = self._get_module(self._class_to_module[name])
2272 value = getattr(module, name)
2273 else:

~\anaconda3\lib\site-packages\transformers\file_utils.py in _get_module(self, module_name)
2281 return importlib.import_module("." + module_name, self.name)
2282 except Exception as e:
-> 2283 raise RuntimeError(
2284 f"Failed to import {self.name}.{module_name} because of the following error (look up to see its traceback):\n{e}"
2285 ) from e

RuntimeError: Failed to import transformers.models.rag.modeling_rag because of the following error (look up to see its traceback):
DLL load failed while importing _swigfaiss: The specified module could not be found.

Were you able to solve this issue? Am facing the same problem. I created new conda environment and installed haystack and python, but having same issue.

No. I gave up on faiss.

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  • faiss-cpu -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

I got this warning after unsiatlling and installing new conda environment. The command i used was conda install faiss-cpu -c pytorch. Am planning to create one more conda environment by degrading conda environment.

UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:

Specifications:

  • faiss-cpu -> python[version='>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.

I got this warning after unsiatlling and installing new conda environment. The command i used was conda install faiss-cpu -c pytorch. Am planning to create one more conda environment by degrading conda environment.

I was able to solve with new conda environment with 3.7 ver