In order to use mpi4py on Piz Daint, you will need to install it using the cray compiler, which will include and link it to the correct cray-mpich header files and libraries.

Step-by-step guide

  1. Create and activate your python virtual enviroment e.g.: as described here: https://user.cscs.ch/tools/interactive/python/#python-virtual-environments
  2. Install mpi4py using a cray compiler by defining the MPICC environment variable:
    MPICC=cc pip install -U mpi4py 


Without the correct compiler you will probably get compilation errors when running `pip install mpi4py`, e.g.: 
fatal error: mpi.h: No such file or directory