KEMBAR78
`faiss` fails to import on python==3.12 because of deprecated `numpy.distutils` · Issue #3936 · facebookresearch/faiss · GitHub
Skip to content

faiss fails to import on python==3.12 because of deprecated numpy.distutils #3936

@GaetanLepage

Description

@GaetanLepage

Summary

To know whether the system supports SVE, faiss uses deprecated numpy.distutils.cpuinfo.
This has been removed and crashes on Python 3.12 (on aarch64-linux systems) with:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/nix/store/6iq3nhgdyp8a5wzwf097zf2mn4zyqxr6-python3-3.12.5/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/nix/store/x3g3x2s64qwsrrrg6cpfc84zycc4hlbh-python3.12-faiss-1.9.0/lib/python3.12/site-packages/faiss/__init__.py", line 16, in <module>
    from .loader import *
  File "/nix/store/x3g3x2s64qwsrrrg6cpfc84zycc4hlbh-python3.12-faiss-1.9.0/lib/python3.12/site-packages/faiss/loader.py", line 88, in <module>
    instruction_sets = supported_instruction_sets()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/x3g3x2s64qwsrrrg6cpfc84zycc4hlbh-python3.12-faiss-1.9.0/lib/python3.12/site-packages/faiss/loader.py", line 53, in supported_instruction_sets
    if is_sve_supported():
       ^^^^^^^^^^^^^^^^^^
  File "/nix/store/x3g3x2s64qwsrrrg6cpfc84zycc4hlbh-python3.12-faiss-1.9.0/lib/python3.12/site-packages/faiss/loader.py", line 43, in is_sve_supported
    import numpy.distutils.cpuinfo
ModuleNotFoundError: No module named 'numpy.distutils'

Platform

OS: NixOS

Faiss version: 1.9.0

Installed from: Nix

Faiss compilation options:

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

  • import faiss

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    1.13.0

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions