nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 112 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitLab, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 astropy, 12 ducc0, 13 h5py, 14 jax, 15 jaxlib, 16 matplotlib, 17 mpi, 18 mpi4py, 19 numpy, 20 scipy, 21 22 # test 23 pytestCheckHook, 24 pytest-xdist, 25 mpiCheckPhaseHook, 26 openssh, 27}: 28 29buildPythonPackage rec { 30 pname = "nifty8"; 31 version = "8.5.7"; 32 pyproject = true; 33 34 src = fetchFromGitLab { 35 domain = "gitlab.mpcdf.mpg.de"; 36 owner = "ift"; 37 repo = "nifty"; 38 tag = "v${version}"; 39 hash = "sha256-5KPmM1UaXnS/ZEsnyFyxvDk4Nc4m6AT5FDgmCG6U6YU="; 40 }; 41 42 # nifty8.re is the jax-backed version of nifty8 (the regular one uses numpy). 43 # It is not compatible with the latest jax update: 44 # https://gitlab.mpcdf.mpg.de/ift/nifty/-/issues/414 45 # While the issue is being fixed by upstream, we completely remove this package from the source and the tests. 46 postPatch = '' 47 rm -r src/re 48 rm -r test/test_re 49 ''; 50 51 build-system = [ setuptools ]; 52 53 dependencies = [ 54 astropy 55 ducc0 56 h5py 57 jax 58 jaxlib 59 matplotlib 60 mpi4py 61 mpi 62 numpy 63 scipy 64 ]; 65 66 nativeCheckInputs = [ 67 pytestCheckHook 68 pytest-xdist 69 mpiCheckPhaseHook 70 openssh 71 ]; 72 73 # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase 74 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin '' 75 export MPLBACKEND="Agg" 76 ''; 77 78 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ 79 # [XPASS(strict)] np.vdot inaccurate for single precision 80 "test_vdot" 81 ]; 82 83 __darwinAllowLocalNetworking = true; 84 postCheck = 85 lib.optionalString 86 ( 87 # Fails on aarch64-linux with: 88 # hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery. 89 # All nodes which are allocated for this job are already filled. 90 !(stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) 91 ) 92 '' 93 ${lib.getExe' mpi "mpirun"} -n 2 --bind-to none python3 -m pytest test/test_mpi 94 ''; 95 96 pythonImportsCheck = [ "nifty8" ]; 97 98 meta = { 99 homepage = "https://gitlab.mpcdf.mpg.de/ift/nifty"; 100 changelog = "https://gitlab.mpcdf.mpg.de/ift/nifty/-/blob/v${version}/ChangeLog.md"; 101 description = "Bayesian Imaging library for high-dimensional posteriors"; 102 longDescription = '' 103 NIFTy, "Numerical Information Field Theory", is a Bayesian imaging library. 104 It is designed to infer the million to billion dimensional posterior 105 distribution in the image space from noisy input data. At the core of 106 NIFTy lies a set of powerful Gaussian Process (GP) models and accurate 107 Variational Inference (VI) algorithms. 108 ''; 109 license = lib.licenses.gpl3; 110 maintainers = with lib.maintainers; [ parras ]; 111 }; 112}