# You appear to have run julia under a different \`mpiexec\` than the one used by MPI.jl

**URL:** https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836
**Category:** General Usage
**Tags:** question
**Created:** [December 15, 2020, 12:04am UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836 "2020-12-15T00:04:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Blatter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daniel_blatter/32/9041_2.png) [@Daniel\_Blatter](https://discourse.julialang.org/u/Daniel_Blatter)
#### Post date: [December 15, 2020, 12:04am UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836/1 "2020-12-15T00:04:58Z")

</div>

I’m running MacOS 10.15.6 and I use OpenMPI to run Julia programs. It worked fine with Julia 1.1. Then I uninstalled Julia 1.1, installed Julia 1.5.3, added the MPI.jl package, and now I get the following error whenever I run MPI:

```julia
You appear to have run julia under a different `mpiexec` than the one used by MPI.jl

```

The command I’m running from the terminal is:

```julia
mpirun julia test_mpi.jl

```

I have version 4.0.5 of Open MPI installed:

```julia
Dan@Daniels-MacBook-Pro 2DMT % mpirun --version
mpirun (Open MPI) 4.0.5

```

What I’ve noticed is that every process thinks it’s rank 0 and knows of no other processes, even though there should be 4 (the number of cores on my Macbook.

Does anyone know how I’m running a different version of julia than MPI.jl? I installed MPI.jl the usual way:

```julia
Pkg.add("MPI")

```

I don’t have any other versions of julia installed, as I cleaned my computer of everything julia related before installing julia 1.5.3.

The code I’m running is very simple:

```julia
import MPI

MPI.Init()

comm = MPI.COMM_WORLD
rank = MPI.Comm_rank(comm)
nproc = MPI.Comm_size(comm)

println("My rank is ",rank," and I am 1 of ",nproc," processes.")

MPI.Barrier(comm)

MPI.Finalize()

```

Running this code yields the above warning, plus

```julia
My rank is 0 and I am 1 of 1 processes

```

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [December 15, 2020, 12:17am UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836/2 "2020-12-15T00:17:11Z")

</div>

If you want to use system MPI, you need to tell `MPI.jl` so: [Configuration · MPI.jl](https://juliaparallel.github.io/MPI.jl/latest/configuration/#Using-a-system-provided-MPI).

If you want to be sure to use the right `mpirun` I recommend using the `mpiexec` wrapper provided by `MPI.jl`: [Configuration · MPI.jl](https://juliaparallel.github.io/MPI.jl/latest/configuration/#Julia-wrapper-for-mpiexec)

---

<div class="post-metadata">

### Author: ![Daniel\_Blatter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daniel_blatter/32/9041_2.png) [@Daniel\_Blatter](https://discourse.julialang.org/u/Daniel_Blatter)
#### Post date: [December 15, 2020, 12:42am UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836/3 "2020-12-15T00:42:36Z")

</div>

Thanks for the quick reply. Is there any way to check where MPI.jl is searching for my OpenMPI build? Following your advice, I get the following result:

```julia
Dan@Daniels-MacBook-Pro 2DMT % julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'
   Building MPI → `~/.julia/packages/MPI/b7MVG/deps/build.log`
[ Info: using system MPI
ERROR: LoadError: libmpi could not be found
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/Dan/.julia/packages/MPI/b7MVG/deps/build.jl:76
 [3] include(::String) at ./client.jl:457
 [4] top-level scope at none:5
in expression starting at /Users/Dan/.julia/packages/MPI/b7MVG/deps/build.jl:64
┌ Error: Error building `MPI`: 
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

```

---

<div class="post-metadata">

### Author: ![Daniel\_Blatter](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daniel_blatter/32/9041_2.png) [@Daniel\_Blatter](https://discourse.julialang.org/u/Daniel_Blatter)
#### Post date: [December 15, 2020, 12:47am UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836/4 "2020-12-15T00:47:40Z")

</div>

Ok, solved it. Had to add

```julia
export JULIA_MPI_PATH=/opt/openmpi/

```

To my ~/.profile

---

<div class="post-metadata">

### Author: ![spasmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/spasmann/32/31019_2.png) [@spasmann](https://discourse.julialang.org/u/spasmann)
#### Post date: [November 22, 2021, 9:53pm UTC](https://discourse.julialang.org/t/you-appear-to-have-run-julia-under-a-different-mpiexec-than-the-one-used-by-mpi-jl/51836/5 "2021-11-22T21:53:52Z")

</div>

I’ve had the same problem, could describe your solution a bit more? Where did you add the line? I’m not sure what’s meant by your ~/.profile.

```julia
(base) sam@Sams-MacBook-Pro ~ % julia --project -e 'ENV["JULIA_MPI_BINARY"]="system"; using Pkg; Pkg.build("MPI"; verbose=true)'

   Building MPI → `~/.julia/packages/MPI/biSVL/deps/build.log`
[ Info: using system MPI
ERROR: LoadError: libmpi could not be found
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] top-level scope at /Users/sam/.julia/packages/MPI/biSVL/deps/build.jl:76
 [3] include(::String) at ./client.jl:457
 [4] top-level scope at none:5
in expression starting at /Users/sam/.julia/packages/MPI/biSVL/deps/build.jl:64
┌ Error: Error building `MPI`: 
└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949

```
