# Problem with distributed, @everywhere using gives error on workers

**URL:** <https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790>\
**Category:** New to Julia\
**Created:** [June 5, 2020, 4:27am UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790 "2020-06-05T04:27:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjentsch0](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjentsch0/32/15148_2.png) [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Post date:** [June 5, 2020, 4:27am UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/1 "2020-06-05T04:27:18Z")

</div>

```julia
julia> using MuladdMacro

julia> @everywhere using MuladdMacro
ERROR: On worker 2:
ArgumentError: Package MuladdMacro not found in current path:
- Run `import Pkg; Pkg.add("MuladdMacro")` to install the MuladdMacro package.

```

I’ve seen tonnes of posts on this, and none of them offered a fix to my problem. I’ve never had JuliaPro on this laptop, which is a common cause of this error apparently.

```julia
julia> Base.load_path()
3-element Array{String,1}:
 "\\home\\peter\\.julia\\environments\\v1.4\\Project.toml"
 "C:\\Users\\pjent\\.julia\\environments\\v1.4\\Project.toml"
 "C:\\Julia-1.4.2\\share\\julia\\stdlib\\v1.4"

julia> remotecall_fetch(Base.load_path, 2)
2-element Array{String,1}:
 "C:\\Users\\pjent\\.julia\\environments\\v1.4\\Project.toml"
 "C:\\Julia-1.4.2\\share\\julia\\stdlib\\v1.4"

```

The top entry in `load_path` is from a cluster I use the VSCode Remote SSH extensions to use. Maybe that’s the problem?

I tried completely removing and adding Julia, but this problem remains. I guess I left a bit behind?

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [June 5, 2020, 10:10pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/2 "2020-06-05T22:10:19Z")

</div>

I am not sure if I understand. Are your workers in the same machine? If one of your workers is in a remote machine and you do not have your package installed there, it cannot load the package. To be sure they are installed, do what the message says, and at least one time call:

```julia
@everywhere import Pkg
@everywhere Pkg.add("MuladdMacro")

```

---

<div class="post-metadata">

**Author:** ![pjentsch0](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjentsch0/32/15148_2.png) [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Post date:** [June 5, 2020, 10:21pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/3 "2020-06-05T22:21:18Z")

</div>

Sorry, yes they are on the same machine, which is why it’s so confusing.

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [June 5, 2020, 10:23pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/4 "2020-06-05T22:23:15Z")

</div>

When you start your julia session are you in a particular environment? that is, are you doing `julia --project=/some/project` , or alternatively, are you changing the environment programatically once Julia is launched i.e `] activate env`

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [June 5, 2020, 10:27pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/5 "2020-06-05T22:27:54Z")

</div>

If you are using an environment/project (i.e., `Project.toml`/`Manifest.toml` files) it may be necessary to call `Pkg.activate("path/to/folder/with/toml/files/")` in the workers (with `@everywhere`). Also, note that `@everywhere` only executes the code in the workers currently running. So if you do some setup with `@everywhere` before calling `addprocs` (or some other method to create workers) those newly created workers will not have executed the setup you did with `@everywhere` before.

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [June 5, 2020, 10:32pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/6 "2020-06-05T22:32:51Z")

</div>

Adding to the previous answer (and based on my reply), you could also do

`addprocs(n, exeflags="--project=/path/project")`

---

<div class="post-metadata">

**Author:** ![pjentsch0](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pjentsch0/32/15148_2.png) [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Post date:** [June 5, 2020, 11:40pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/7 "2020-06-05T23:40:31Z")

</div>

It seems like I wasn’t starting up in the default environment. Thanks! VSCode automatically starts up in the folder environment if the folder is a package.

---

<div class="post-metadata">

**Author:** ![felipenoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/felipenoris/32/553_2.png) [@felipenoris](https://discourse.julialang.org/u/felipenoris)\
**Post date:** [June 5, 2020, 11:55pm UTC](https://discourse.julialang.org/t/problem-with-distributed-everywhere-using-gives-error-on-workers/40790/8 "2020-06-05T23:55:10Z")

</div>

[https://github.com/JuliaLang/julia/issues/28781](https://github.com/JuliaLang/julia/issues/28781)

I personally don’t agree that the idea of this issue should be implemented (unless there is an explicit command by the user to do so), but it explains the problem that you’re hitting.
