diff --git a/pkgs/development/libraries/science/math/faiss/default.nix b/pkgs/by-name/fa/faiss/package.nix similarity index 84% rename from pkgs/development/libraries/science/math/faiss/default.nix rename to pkgs/by-name/fa/faiss/package.nix index 2f635fa7bd53..84ef5f6a1e25 100644 --- a/pkgs/development/libraries/science/math/faiss/default.nix +++ b/pkgs/by-name/fa/faiss/package.nix @@ -7,7 +7,7 @@ cudaPackages ? { }, cudaSupport ? config.cudaSupport, pythonSupport ? true, - pythonPackages, + python3Packages, llvmPackages, blas, swig, @@ -25,7 +25,7 @@ let pname = "faiss"; - version = "1.9.0"; + version = "1.10.0"; inherit (cudaPackages) flags backendStdenv; @@ -50,16 +50,9 @@ stdenv.mkDerivation { owner = "facebookresearch"; repo = "faiss"; tag = "v${version}"; - hash = "sha256-P8TynU6jz5NbcWLdI7n4LX5Gdz0Ks72bmOzQ3LGjQCQ="; + hash = "sha256-Jws6AW0rj6N/MOoaxK6N7KaPkjCYN47Il0xzyKZ7Wc0="; }; - postPatch = lib.optionalString pythonSupport '' - substituteInPlace faiss/python/loader.py \ - --replace-fail \ - "# platform-dependent legacy fallback using numpy.distutils.cpuinfo" \ - "return False" - ''; - nativeBuildInputs = [ cmake ] ++ lib.optionals cudaSupport [ @@ -67,9 +60,9 @@ stdenv.mkDerivation { autoAddDriverRunpath ] ++ lib.optionals pythonSupport [ - pythonPackages.python - pythonPackages.setuptools - pythonPackages.pip + python3Packages.python + python3Packages.setuptools + python3Packages.pip ]; buildInputs = @@ -77,7 +70,7 @@ stdenv.mkDerivation { blas swig ] - ++ lib.optionals pythonSupport [ pythonPackages.numpy ] + ++ lib.optionals pythonSupport [ python3Packages.numpy ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ] ++ lib.optionals cudaSupport cudaComponents; diff --git a/pkgs/development/python-modules/autofaiss/default.nix b/pkgs/development/python-modules/autofaiss/default.nix index 1fd7b41d3e5e..88f990cb52d8 100644 --- a/pkgs/development/python-modules/autofaiss/default.nix +++ b/pkgs/development/python-modules/autofaiss/default.nix @@ -1,31 +1,38 @@ { + lib, buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies embedding-reader, faiss, - fetchFromGitHub, fire, fsspec, - lib, numpy, pyarrow, + pytestCheckHook, - pythonOlder, }: buildPythonPackage rec { pname = "autofaiss"; version = "2.17.0"; - format = "setuptools"; - - disabled = pythonOlder "3.6"; + pyproject = true; src = fetchFromGitHub { owner = "criteo"; - repo = pname; + repo = "autofaiss"; tag = version; hash = "sha256-pey3wrW7CDLMiPPKnmYrcSJqGuy6ecA2SE9m3Jtt6DU="; }; + build-system = [ + setuptools + ]; + pythonRemoveDeps = [ # The `dataclasses` packages is a python2-only backport, unnecessary in # python3. @@ -41,14 +48,17 @@ buildPythonPackage rec { # As of v2.15.3, autofaiss asks for pyarrow<8 but we have pyarrow v9.0.0 in # nixpkgs at the time of writing (2022-12-15). "pyarrow" + + # No official numpy2 support yet + "numpy" ]; - propagatedBuildInputs = [ + dependencies = [ embedding-reader - fsspec - numpy faiss fire + fsspec + numpy pyarrow ]; @@ -61,14 +71,20 @@ buildPythonPackage rec { "test_index_correctness_in_distributed_mode_with_multiple_indices" "test_index_correctness_in_distributed_mode" "test_quantize_with_pyspark" + + # TypeError: Object of type float32 is not JSON serializable + "test_quantize" + "test_quantize_with_empty_and_non_empty_files" + "test_quantize_with_ids" + "test_quantize_with_multiple_inputs" ]; - meta = with lib; { + meta = { description = "Automatically create Faiss knn indices with the most optimal similarity search parameters"; mainProgram = "autofaiss"; homepage = "https://github.com/criteo/autofaiss"; changelog = "https://github.com/criteo/autofaiss/blob/${version}/CHANGELOG.md"; - license = licenses.asl20; - maintainers = with maintainers; [ samuela ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ samuela ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 609bd3827562..2bea3142503c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17365,10 +17365,6 @@ with pkgs; jre = openjdk17; }; - faiss = callPackage ../development/libraries/science/math/faiss { - pythonPackages = python3Packages; - }; - faissWithCuda = faiss.override { cudaSupport = true; }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index afdff1e77072..7b961fe3dde3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4450,7 +4450,7 @@ self: super: with self; { faiss = callPackage ../development/python-modules/faiss { faiss-build = pkgs.faiss.override { pythonSupport = true; - pythonPackages = self; + python3Packages = self; }; };