Error when installing mpi4py

2019-03-17 22:43发布

I'm trying to install mpi4py using pip install mpi4py, but I'm getting the following error:

error: Cannot find 'mpi.h' header. Check your configuration!!!

Earlier in the same error report I have,

clang: error: linker command failed with exit code 1 (use -v to see    invocation)

What might the problem be?

Thanks!

5条回答
相关推荐>>
2楼-- · 2019-03-17 23:16

If somebody stumbles by and has the same problem I had:

I wanted to install mpi4py using pip as root:

sudo pip install mpi4py

I got the error message that mpi.h was missing during the installation. The path was set correctly, but only for my user, not for root. So if you run into trouble with missing libraries/headers during any installation, make sure the correct environment is also set up for root.

As I use mpi-selector to select which mpi implementation you use, I just had to run mpi-selector as root to set up everything correctly, and the installation succeeded.

查看更多
我想做一个坏孩纸
3楼-- · 2019-03-17 23:18

I met with the similar problem and fixed this by firstly

brew install mpich

And then

pip install mpi4py
查看更多
唯我独甜
4楼-- · 2019-03-17 23:20

As the error says, there are libraries missing. I solved it by installing libopenmpi-dev package

sudo apt install libopenmpi-dev

and then installed the mpi4py using pip

sudo pip install mpi4py
查看更多
在下西门庆
5楼-- · 2019-03-17 23:25

you can do this:

brew install mpich

then

sudo find / -name mpicc

finally

env MPICC=/yourpath/mpicc pip3 install mpi4py
查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-03-17 23:27

If mpi4py cannot find mpi.h, then likely the problem is how you are pointing mpi4py to your existing mpi library.

$ python setup.py build --mpicc=/where/you/have/mpicc

Now, there there are a few special cases related to OS X. You should consult http://mpi4py.scipy.org/docs/usrman/install.html to see if any apply to you.

查看更多
登录 后发表回答