Error when installing mpi4py
44,099
Solution 1
As the error says, there are libraries missing. I solved it by installing libopenmpi-dev package
sudo apt-get install libopenmpi-dev
and then installed the mpi4py using pip
pip install mpi4py
Solution 2
I met with the similar problem and fixed this by firstly
brew install mpich
And then
pip install mpi4py
Solution 3
you can do this:
brew install mpich
then
sudo find / -name mpicc
finally
env MPICC=/yourpath/mpicc pip3 install mpi4py
Solution 4
None of the above solutions worked for me. I just use the conda install:
brew install mpich
conda install mpi4py
Solution 5
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.
Author by
nargles324
Updated on July 09, 2022Comments
-
nargles324 almost 2 years
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!
-
guhur about 8 yearsif you want to use pip, you can do:
env MPICC=/path/to/mpicc/ pip install mpi4py
-
Foon over 7 yearsNote that this question was tagged osx and apt implies debian/ubuntu/related variants (but not saying this answer is bad)
-
Gilles Gouaillardet over 5 years
mpi.h
is a header file andLD_LIBRARY_PATH
is for libraries. The issue was more likely with your$PATH
(e.g.mpicc
and friends were not in your default path) -
frandroid over 4 yearsHi @Frikg, welcome to Stack Overflow. Indeed, your answer doesn't seem to be addressing the specific problem that the original poster had, and seems offtopic!
-
frikg over 4 yearshi @frandroid , you are right . I 've been searching for days to install it so i hope that someone who has the same issue with me will come across with my answer (title helps to easy find this post) :)
-
ComputerScientist about 4 yearsPlease don't do
sudo pip install XXX
-
M. Erfan Mowlaei almost 4 yearsThe second step was not necessary in my case.