eve
eve

Reputation: 383

ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects

I want to install mpi4py. The installation fails with the error below. Please share the solution to the same error.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects

[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python -m pip install --upgrade pip

I installed pyproject-toml with "pip install pyproject-toml". But mpi4py still won't install. My python version is Python 3.8.0.

Upvotes: 15

Views: 37254

Answers (7)

Khodunov Pavel
Khodunov Pavel

Reputation: 1

I had a similar problem, but for me it had additionally something about not finding Python.h. I recently upgraded python version, and the problem was solved (as described here) via sudo apt-get install python3.X-dev (in my case X was 10).

Upvotes: 0

Yikang Yue
Yikang Yue

Reputation: 109

conda works:

conda install mpi4py

Upvotes: 10

dmon
dmon

Reputation: 1422

I'm using mpich and don't want to install openmpi, but the following worked for me:

pip install mpi4py-mpich

Upvotes: 1

Jas
Jas

Reputation: 415

I had the same error message. I used the Anaconda-Navigator interface and it worked fine.

Another option is to use brew. If OpenMPI isn't a dependency issue for you, the installation worked when I used it as well.

brew install mpi4py

Upvotes: 3

Natalia
Natalia

Reputation: 1

For me it worked when I used sudo before:

sudo pip install mpi4py

Upvotes: -3

eve
eve

Reputation: 383

It seems that related packages are twisted. Installed by following the steps below.

apt --fix-broken install
apt install mpich
pip install mpi4py

Upvotes: 7

AliMezher18
AliMezher18

Reputation: 149

The following worked for me:

sudo apt update

sudo apt-get install libopenmpi-dev

Upvotes: 14

Related Questions