at 18.09-beta 1.5 kB view raw
1{ stdenv, fetchPypi, python, buildPythonPackage, mpi, openssh }: 2 3buildPythonPackage rec { 4 pname = "mpi4py"; 5 version = "3.0.0"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "1mzgd26dfv4vwbci8gq77ss9f0x26i9aqzq9b9vs9ndxhlnv0mxl"; 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 buildInputs = [ mpi openssh ]; 45 46 meta = { 47 description = 48 "Python bindings for the Message Passing Interface standard"; 49 homepage = http://code.google.com/p/mpi4py/; 50 license = stdenv.lib.licenses.bsd3; 51 }; 52}