Error building MPI---ERROR: LoadError: libmpi could not be found

I was trying to build MPI and had the following error (after several searches/tries, see below)

(@v1.6) pkg> build MPI

Building MPI → ~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/00488c6fcaf828685c2bc5139bf0afff8c15c982/build.log

ERROR: Error building MPI:

[ Info: using system MPI

ERROR: LoadError: libmpi could not be found


[1] error(s::String)

@ Base ./error.jl:33

[2] top-level scope

@ ~/.julia/packages/MPI/90ZrE/deps/build.jl:76

[3] include(fname::String)

@ Base.MainInclude ./client.jl:444

[4] top-level scope

@ none:5

in expression starting at /Users/quanlingdeng/.julia/packages/MPI/90ZrE/deps/build.jl:64

Some background info:

  1. my julia version is 1.6.1
  2. my mpi version is (Open MPI) 4.1.1
  3. my openmpi location is /usr/local/Cellar/open-mpi/4.1.1_2

What I tried

  1. specified the JULIA_MPI_PATH by following
    You appear to have run julia under a different `mpiexec` than the one used by MPI.jl
    Error in bulid MPI
  2. tried
julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg;"MPI"; verbose=true)'

All these led to same error: “libmpi could not be found”

A similar issue appears here
replace ~ by the webpage domain. I can only post two links as being a new user;-) )

I was wondering if anyone could help with building MPI in Julia? Thanks in advance.

Take a look at the other environmental variables listed here:

Thanks a lot!
I have now figured it out and it worked.
I did not change any of these other environmental variables but did the following

  1. go to a terminal
  2. type emacs ~/.julia/prefs/MPI.toml
  3. set path = “/usr/local/Cellar/open-mpi/4.1.1_2”

It seems that the way of setting the path is different from the ways in the two links in my original post which were in the files ~/.bash_profile or ~/.profile

Maybe it’s Julia version thing

1 Like