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

An error occurred while importing faiss #1979

Closed
2 tasks
JQZhai opened this issue Jul 8, 2021 · 6 comments
Closed
2 tasks

An error occurred while importing faiss #1979

JQZhai opened this issue Jul 8, 2021 · 6 comments

Comments

@JQZhai
Copy link

JQZhai commented Jul 8, 2021

Summary

I get an error when I try to import faiss in python3

Platform

jetson xavier NX

OS:

Faiss version: 1.7.1

Installed from: compiled by myself

Faiss compilation options:

cmake -B build . -DFAISS_ENABLE_GPU=OFF
make -C build -j faiss
make -C build -j swigfaiss
(cd build/faiss/python && sudo python3 setup.py install)

Running on:

  • CPU

Interface:

  • Python

Reproduction instructions

Type "help", "copyright", "credits" or "license" for more information.

import faiss
Traceback (most recent call last):
File "/home/mec/Downloads/faiss/build/faiss/python/faiss/swigfaiss.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 658, in _load_unlocked
File "", line 571, in module_from_spec
File "", line 922, in create_module
File "", line 219, in _call_with_frames_removed
ImportError: /home/mec/Downloads/faiss/build/faiss/python/faiss/_swigfaiss.so: undefined symbol: Z9vsubq_u1612__Uint16x8_tS

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/home/mec/Downloads/faiss/build/faiss/python/faiss/init.py", line 18, in
from .loader import *
File "/home/mec/Downloads/faiss/build/faiss/python/faiss/loader.py", line 65, in
from .swigfaiss import *
File "/home/mec/Downloads/faiss/build/faiss/python/faiss/swigfaiss.py", line 17, in
_swigfaiss = swig_import_helper()
File "/home/mec/Downloads/faiss/build/faiss/python/faiss/swigfaiss.py", line 16, in swig_import_helper
return importlib.import_module('_swigfaiss')
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: /home/mec/Downloads/faiss/build/faiss/python/_swigfaiss.so: undefined symbol: Z9vsubq_u1612__Uint16x8_tS

@derneuere
Copy link

@JQZhai I have the same error. Did you find a workaround, or do older versions work?

@vorj
Copy link
Contributor

vorj commented Aug 24, 2021

@JQZhai #1916 (comment)

@derneuere
Copy link

@vorj
Copy link
Contributor

vorj commented Aug 26, 2021

@derneuere How did you determine the cause of stopping job was on faiss in spite of no error?

@derneuere
Copy link

derneuere commented Aug 26, 2021

@vorj Just by trial and error. I removed the argument and the job finished. This is the current file that builds: https://github.com/LibrePhotos/librephotos-docker/blob/c904870f451b8ba1e1aa2e109981fba231397caa/backend/dependencies/Dockerfile

Again, it works on x64 after building without the parameter, but it fails on arm when starting up. I use docker buildx with github actions to build it for multiple architectures.

@vorj
Copy link
Contributor

vorj commented Aug 27, 2021

@derneuere Isn't that just an OOM killing caused by make -j on a low memory environment rather than the issue of building faiss for ARM?
If you had read INSTALL.md of faiss attentively, you would have found the below note:

The -j option enables parallel compilation of multiple units, leading to a faster build, but increasing the chances of running out of memory, in which case it is recommended to set the -j option to a fixed value (such as -j4).

CI of this project, too, limits the count of simultaneous make jobs due to avoid OOM.

I also recommend you to read the man page of make before using that if you forget or don't know the usage.

Finally if you want more discussion about your problem, please create the new issue about it, because your problem has no relation about this (error while importing faiss) issue.

@mdouze mdouze closed this as completed Jan 19, 2022
facebook-github-bot pushed a commit that referenced this issue Mar 23, 2023
Summary:
related: #1916, #1979, #2009, #2013, #2195, #2210

After my PR #1815 had been merged `-DCMAKE_BUILD_TYPE=Debug` has been invalid on aarch64, and many people have been hit the problem. (sorry to inconvenience...)
This PR fixes this.

### Details:

Using the function pointers of intrinsics on run-time context causes the link errors.
`-DCMAKE_BUILD_TYPE=Release` has been available because compiler optimizer can propagate and collapse the function pointers as constant.
However, when the pointers doesn't collapsed the link errors occurred, so `-DCMAKE_BUILD_TYPE=Debug` has been unavailable.
To prevent the link errors, I've replaced the function pointers of intrinsics on run-time context to on compile-time context explicitly.

Pull Request resolved: #2768

Reviewed By: mdouze

Differential Revision: D44296147

Pulled By: alexanderguzhva

fbshipit-source-id: 81fa013c5e05a486b6b82cb85d76eeefdefca891
mdouze added a commit that referenced this issue Mar 23, 2023
* fix windows test (#2775)

Summary: Pull Request resolved: #2775

Reviewed By: algoriddle

Differential Revision: D44210010

fbshipit-source-id: b9b620a4b0a874e09ee2f6082ff0f9463716fdf4

* faiss/utils/simdlib_avx2.h: avoid C++20 ambiguous overloaded operator (#2772)

Summary:
Pull Request resolved: #2772

Resolves errors from overloaded ambiguous operators:
```
faiss/utils/partitioning.cpp:283:34: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'faiss::simd16uint16' and 'faiss::simd16uint16') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
```

Reviewed By: alexanderguzhva, meyering

Differential Revision: D44186458

fbshipit-source-id: 0257fa0aaa4fe74c056bef751591f5f7e5357c9d

* Fix Debug Build on aarch64 (#2768)

Summary:
related: #1916, #1979, #2009, #2013, #2195, #2210

After my PR #1815 had been merged `-DCMAKE_BUILD_TYPE=Debug` has been invalid on aarch64, and many people have been hit the problem. (sorry to inconvenience...)
This PR fixes this.

### Details:

Using the function pointers of intrinsics on run-time context causes the link errors.
`-DCMAKE_BUILD_TYPE=Release` has been available because compiler optimizer can propagate and collapse the function pointers as constant.
However, when the pointers doesn't collapsed the link errors occurred, so `-DCMAKE_BUILD_TYPE=Debug` has been unavailable.
To prevent the link errors, I've replaced the function pointers of intrinsics on run-time context to on compile-time context explicitly.

Pull Request resolved: #2768

Reviewed By: mdouze

Differential Revision: D44296147

Pulled By: alexanderguzhva

fbshipit-source-id: 81fa013c5e05a486b6b82cb85d76eeefdefca891

---------

Co-authored-by: Matthijs Douze <[email protected]>
Co-authored-by: Jeff Palm <[email protected]>
Co-authored-by: Y.Imaizumi <[email protected]>
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

4 participants