Error when installing mpi4py on Ubuntu instance
Question:
I’m trying to install mpi4py on my Ubuntu 18.04 instance. I have python3.6.5 installed.
First I try sudo apt-get build-dep python-mpi4py
and I get:
Reading package lists… Done E: You must put some ‘source’ URIs in
your sources.list
I then try to install simply with pip install mpi4py
. I get a long error message and I include some of the most important parts below:
checking for library 'lmpe' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
--------------------------------------------------------------------------
failure.
This failure occurs for most libraries. I include just one of the many, and
warning: build_clib: command '/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc' failed with exit status 1
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
Running which mpcc
gives:
(tensorflow_p36) ubuntu@ip-172-31-35-200:~$ which mpicc
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc
How can I add the specified compiler x86_64-conda_cos6-linux-gnu-cc to my PATH in order to resolve this error?
Answers:
Simply run:
conda install -c anaconda mpi4py
as shown here.
Also, a helpful comment by Lidandro Dalcin:
I guess you are missing the mpich-mpicc package, this one is a
metapackage that depends in the right compiler. Why are you installing
mpi4py with pip? Maybe all you need is to conda install mpi4py
(available in the conda-forge channel) ?
Or if you don’t want to use conda…
sudo apt install mpi-default-dev
I’m trying to install mpi4py on my Ubuntu 18.04 instance. I have python3.6.5 installed.
First I try sudo apt-get build-dep python-mpi4py
and I get:
Reading package lists… Done E: You must put some ‘source’ URIs in
your sources.list
I then try to install simply with pip install mpi4py
. I get a long error message and I include some of the most important parts below:
checking for library 'lmpe' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
--------------------------------------------------------------------------
failure.
This failure occurs for most libraries. I include just one of the many, and
warning: build_clib: command '/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc' failed with exit status 1
warning: build_clib: building optional library "vt-mpi" failed
checking for library 'vt-hyb' ...
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc -pthread -B /home/ubuntu/anaconda3/envs/tensorflow_p36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
--------------------------------------------------------------------------
The Open MPI wrapper compiler was unable to find the specified compiler
x86_64-conda_cos6-linux-gnu-cc in your PATH.
Note that this compiler was either specified at configure time or in
one of several possible environment variables.
Running which mpcc
gives:
(tensorflow_p36) ubuntu@ip-172-31-35-200:~$ which mpicc
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/mpicc
How can I add the specified compiler x86_64-conda_cos6-linux-gnu-cc to my PATH in order to resolve this error?
Simply run:
conda install -c anaconda mpi4py
as shown here.
Also, a helpful comment by Lidandro Dalcin:
I guess you are missing the mpich-mpicc package, this one is a
metapackage that depends in the right compiler. Why are you installing
mpi4py with pip? Maybe all you need is to conda install mpi4py
(available in the conda-forge channel) ?
Or if you don’t want to use conda…
sudo apt install mpi-default-dev