From 72d67cec14a967d475c7db65ce2c0a33d6322a8c Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 1 Mar 2025 13:52:43 +0100 Subject: [PATCH 1/5] python312Packages.nifty8: remove nifty8.re as it is incompatible with the latest jax version https://gitlab.mpcdf.mpg.de/ift/nifty/-/issues/414 --- pkgs/development/python-modules/nifty8/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/nifty8/default.nix b/pkgs/development/python-modules/nifty8/default.nix index 9e816b01b7fb..02fa372a1f24 100644 --- a/pkgs/development/python-modules/nifty8/default.nix +++ b/pkgs/development/python-modules/nifty8/default.nix @@ -38,6 +38,15 @@ buildPythonPackage rec { hash = "sha256-Q42ZhQ/T8JmkG75BexevbvVKQqfDmMG6+oTYR0Ze718="; }; + # nifty8.re is the jax-backed version of nifty8 (the regular one uses numpy). + # It is not compatible with the latest jax update: + # https://gitlab.mpcdf.mpg.de/ift/nifty/-/issues/414 + # While the issue is being fixed by upstream, we completely remove this package from the source and the tests. + postPatch = '' + rm -r src/re + rm -r test/test_re + ''; + build-system = [ setuptools ]; dependencies = [ From 0674f0eb951978444977481e4b3465822b35af48 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 1 Mar 2025 12:07:35 +0100 Subject: [PATCH 2/5] python312Packages.nifty8: add pytest-xdist to speed up the tests --- pkgs/development/python-modules/nifty8/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/nifty8/default.nix b/pkgs/development/python-modules/nifty8/default.nix index 02fa372a1f24..e833fc419715 100644 --- a/pkgs/development/python-modules/nifty8/default.nix +++ b/pkgs/development/python-modules/nifty8/default.nix @@ -21,6 +21,7 @@ # test pytestCheckHook, + pytest-xdist, mpiCheckPhaseHook, openssh, }: @@ -64,6 +65,7 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook + pytest-xdist mpiCheckPhaseHook openssh ]; From d00bbbecb9cac30f283d605ff4da01ff6aa3ee71 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 1 Mar 2025 10:18:56 +0100 Subject: [PATCH 3/5] python312Packages.nifty8: 8.5.4 -> 8.5.6 Diff: https://gitlab.mpcdf.mpg.de/ift/nifty/-/compare/refs/tags/v8.5.4...8.5.6 Changelog: https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/v8.5.6/ChangeLog.md --- pkgs/development/python-modules/nifty8/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/nifty8/default.nix b/pkgs/development/python-modules/nifty8/default.nix index e833fc419715..d0f65fec43f3 100644 --- a/pkgs/development/python-modules/nifty8/default.nix +++ b/pkgs/development/python-modules/nifty8/default.nix @@ -28,7 +28,7 @@ buildPythonPackage rec { pname = "nifty8"; - version = "8.5.4"; + version = "8.5.6"; pyproject = true; src = fetchFromGitLab { @@ -36,7 +36,7 @@ buildPythonPackage rec { owner = "ift"; repo = "nifty"; tag = "v${version}"; - hash = "sha256-Q42ZhQ/T8JmkG75BexevbvVKQqfDmMG6+oTYR0Ze718="; + hash = "sha256-DQPCLRVl/UE1zv7nUZtPJa/sRwmAkHgrcDsxRa/ndX4="; }; # nifty8.re is the jax-backed version of nifty8 (the regular one uses numpy). @@ -87,7 +87,7 @@ buildPythonPackage rec { meta = { homepage = "https://gitlab.mpcdf.mpg.de/ift/nifty"; - changelog = "https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/${src.tag}/ChangeLog.md"; + changelog = "https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/v${version}/ChangeLog.md"; description = "Bayesian Imaging library for high-dimensional posteriors"; longDescription = '' NIFTy, "Numerical Information Field Theory", is a Bayesian imaging library. From d2673def8eab8ed292ae5267b86b912a9672b85c Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 1 Mar 2025 13:59:59 +0100 Subject: [PATCH 4/5] python312Packages.nifty8: refactor checkPhase --- .../python-modules/nifty8/default.nix | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/nifty8/default.nix b/pkgs/development/python-modules/nifty8/default.nix index d0f65fec43f3..2c57393731e4 100644 --- a/pkgs/development/python-modules/nifty8/default.nix +++ b/pkgs/development/python-modules/nifty8/default.nix @@ -70,18 +70,18 @@ buildPythonPackage rec { openssh ]; - checkPhase = '' - runHook preCheck - - python3 -m pytest test - - if [ "${stdenv.buildPlatform.system}" != "aarch64-linux" ] && \ - [ "${stdenv.buildPlatform.system}" != "x86_64-darwin" ]; then - ${mpi}/bin/mpiexec -n 2 --bind-to none python3 -m pytest test/test_mpi - fi - - runHook postCheck - ''; + __darwinAllowLocalNetworking = true; + postCheck = + lib.optionalString + ( + # Fails on aarch64-linux with: + # hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery. + # All nodes which are allocated for this job are already filled. + !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) + ) + '' + ${lib.getExe' mpi "mpirun"} -n 2 --bind-to none python3 -m pytest test/test_mpi + ''; pythonImportsCheck = [ "nifty8" ]; From d2b3b4975e134ae18fc39639b2d9948ca54d5c3f Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 1 Mar 2025 14:00:14 +0100 Subject: [PATCH 5/5] python312Packages.nifty8: disable crashing tests on darwin --- pkgs/development/python-modules/nifty8/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/development/python-modules/nifty8/default.nix b/pkgs/development/python-modules/nifty8/default.nix index 2c57393731e4..2ffbde2ed8b2 100644 --- a/pkgs/development/python-modules/nifty8/default.nix +++ b/pkgs/development/python-modules/nifty8/default.nix @@ -70,6 +70,19 @@ buildPythonPackage rec { openssh ]; + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ + # Fatal Python error: Aborted + # matplotlib/backend_bases.py", line 2654 in create_with_canvas + "test_optimize_kl_domain_expansion" + "test_plot_priorsamples" + ]; + + disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ + # Fatal Python error: Aborted + # matplotlib/backend_bases.py", line 2654 in create_with_canvas + "test/test_plot.py" + ]; + __darwinAllowLocalNetworking = true; postCheck = lib.optionalString