# Installing mpi4py in a Raspberry Pi
1) Activate our virtual environment: `source ~/ENV3/bin/activate`
2) Install Open MPI in your pi by entering the following command: `sudo apt-get install openmpi-bin`.
After installation is complete you can check if it was successful by using `mpicc --showme:version`.
3) Enter `pip install mpi4py` to download and install mpi4py.
4) The installation can be tested with `mpiexec -n 4 python -m mpi4py.bench helloworld` (depending on the number of cores/nodes available to you, it may be necessary to reduce the number of copies that follow the -n option) In a PI4, the above test returned:
```
(ENV3) pi@red:~ $ mpiexec -n 4 python -m mpi4py.bench helloworld
Hello, World! I am process 0 of 4 on red.
Hello, World! I am process 1 of 4 on red.
Hello, World! I am process 2 of 4 on red.
Hello, World! I am process 3 of 4 on red.
```
A similar process can be followed to install mpi4py in MacOS. In this case, we can use Homebrew to get Open MPI by entering: `brew install open-mpi`.
Once Open MPI is working, steps 3 and 4 from the above pi4 installation can be followed in order to download and install mpi4py.