How to Install “Python3-mpi4py” package on Linux?
Mpi4py is a Python package that implements the Message Passing Interface (MPI) standard. It is built on top of the MPI specification and provides an API based on the standard MPI-2 C++ bindings. This library may be installed using both the pip manager and the apt packager. Python2 and Python3 are supported via the Mpi4py package. It supports convenient communication of any pickable python object, fast communication, parallel input and output, dynamic process management, etc. The Mpi4py library will be installed on the Linux system in this article.
Installing mpi4py package on Linux using PIP
To install the mpi4py package in Linux follow the following steps:
Step 1: First we set the Python3 environment in Linux operating system. So for the installation process, we will use apt manager.
sudo apt-get install python3
Step 2: Now the next important step is to install the PIP manager in our system. It is a package installation program in Python whose main purpose is to install and manage Python packages. So for the installation run the following command on the terminal.
sudo apt install python3-pip
Step 3: Now, we use pip manager to install the mpi4py package. So follow the below command to install the mpi4py package.
sudo pip3 install mpi4py
sudo apt install python3-mpi4py
Verifying mpi4py package installation on Linux using PIP
After installing the package, the next main step is to verify the installation of the mpi4py package. So in this step, we are just retrieving the information of the installed package (mpi4py) with the below command on the terminal itself.
python3 -m pip show mpi4py
The below output will be displayed after successful installation of the mpi4py package on your Linux machine.