question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'faiss' has no attribute 'swigfaiss'

See original GitHub issue
python 3.8.12
autofaiss                 2.13.2                   pypi_0    pypi
faiss-cpu                 1.7.2                    pypi_0    pypi
libfaiss                  1.7.2            h2bc3f7f_0_cpu    pytorch

First of all, thank you for the great project! I get the error: module 'faiss' has no attribute 'swigfaiss' when running the following command:

import autofaiss

autofaiss.build_index(
    "embeddings.npy",
    "autofaiss.index",
    "autofaiss.json",
    metric_type="ip",
    should_be_memory_mappable=True,
    make_direct_map=True)

The error appears when running it for make_direct_map=True.

Tested using conda 4.11.0 or mamba 0.15.3 using pytorch or conda-forge channel.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
yopknopixxcommented, Nov 19, 2022

I had the exact same issue. Turns out it was due to both faiss-cpu and faiss-gpu being installed.

0reactions
krassermcommented, Dec 21, 2022

With faiss-cpu 1.7.3 (installed via pypi) this issue comes up again and can be reproduced with e.g.

embeddings = np.float32(np.random.rand(100, 512))
build_index(embeddings, make_direct_map=True, save_on_disk=False)

AttributeError: module ‘faiss’ has no attribute ‘swigfaiss’

With faiss-cpu 1.7.2 installed it works as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am getting the below exception when trying to use Faiss 1.5.3
I am getting the below exception when trying to use Faiss 1.5.3. AttributeError: module 'faiss' has no attribute 'IndexFlatL2'. Below is my code...
Read more >
module 'faiss._swigfaiss' has no attribute 'delete_floatvector'
AttributeError: module 'faiss.swigfaiss' has no attribute 'deleteFloatVector'. The code I try to run is: import argparse import os import pickle import time ...
Read more >
No module named '_swigfaiss' in Windows - Stack Overflow
I have an existing linux python project that uses faiss. The project has the following swigfaiss wrapper as detailed here: ...
Read more >
Class faiss::gpu::GpuIndexFlatL2
Flat index does not require IDs as there is no storage available for them. virtual void addImpl_(int n, const float *x, const idx_t...
Read more >
faiss问题记录_codebrid的博客
ModuleNotFoundError: No module named 'faiss' ... from .swigfaiss import * ... 关于报错AttributeError: module 'faiss' has no attribute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found