at 23.05-pre 1.5 kB view raw
1{ lib, fetchPypi, fetchpatch, python, buildPythonPackage, mpi, openssh }: 2 3buildPythonPackage rec { 4 pname = "mpi4py"; 5 version = "3.1.4"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "sha256-F4WPLrxiMiDQEg0fqNQo0DPd50nEvDWzPYGmatf5NIA="; 10 }; 11 12 passthru = { 13 inherit mpi; 14 }; 15 16 postPatch = '' 17 substituteInPlace test/test_spawn.py --replace \ 18 "unittest.skipMPI('openmpi(<3.0.0)')" \ 19 "unittest.skipMPI('openmpi')" 20 ''; 21 22 configurePhase = ""; 23 24 installPhase = '' 25 mkdir -p "$out/lib/${python.libPrefix}/site-packages" 26 export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" 27 28 ${python}/bin/${python.executable} setup.py install \ 29 --install-lib=$out/lib/${python.libPrefix}/site-packages \ 30 --prefix="$out" 31 32 # --install-lib: 33 # sometimes packages specify where files should be installed outside the usual 34 # python lib prefix, we override that back so all infrastructure (setup hooks) 35 # work as expected 36 37 # Needed to run the tests reliably. See: 38 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 39 export OMPI_MCA_rmaps_base_oversubscribe=yes 40 ''; 41 42 setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"]; 43 44 nativeBuildInputs = [ mpi ]; 45 46 checkInputs = [ openssh ]; 47 48 meta = with lib; { 49 description = "Python bindings for the Message Passing Interface standard"; 50 homepage = "https://github.com/mpi4py/mpi4py"; 51 license = licenses.bsd2; 52 }; 53}