# Packages aren't found on worker processors

**URL:** <https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820>\
**Category:** General Usage\
**Tags:** package, distributed\
**Created:** [September 18, 2020, 4:37am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820 "2020-09-18T04:37:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![smickus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smickus/32/18002_2.png) [@smickus](https://discourse.julialang.org/u/smickus)\
**Post date:** [September 18, 2020, 4:37am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/1 "2020-09-18T04:37:23Z")

</div>

When I upgraded to Julia v1.5.1-1 using JuliaPro , the distributed processors no longer can find any of the packages that have been imported. The following is the error message that I receive.

ERROR: LoadError: On worker 2:  
LoadError: ArgumentError: Package Optim not found in current path:

- Run `import Pkg; Pkg.add("Optim")` to install the Optim package.

require at .\loading.jl:893  
include at .\client.jl:457  
top-level scope at none:1  
eval at .\boot.jl:331  
#103 at D:\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\process\_messages.jl:290  
run\_work\_thunk at D:\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\process\_messages.jl:88  
#96 at .\task.jl:356  
in expression starting at C:\Users\smickus3\Documents\CAMM\_Codes\ParrallelOpt\BFGS.jl:1

…and 2 more exception(s).

Stacktrace:  
[1] sync\_end(::Channel{Any}) at .\task.jl:314  
[2] macro expansion at .\task.jl:333 [inlined]  
[3] remotecall\_eval(::Module, ::Array{Int64,1}, ::Expr) at D:\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\macros.jl:218  
[4] top-level scope at D:\buildbot\worker\package\_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\macros.jl:202  
[5] include\_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1088

---

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [September 18, 2020, 4:41am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/2 "2020-09-18T04:41:17Z")

</div>

Perhaps you need to run

```julia
@everywhere using Optim

```

since from your error it looks like the error is on worker 2

```julia
ERROR: LoadError: On worker 2:
LoadError: ArgumentError: Package Optim not found in current path

```

Remember to run this only after you spawn all the workers you need

---

<div class="post-metadata">

**Author:** ![smickus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smickus/32/18002_2.png) [@smickus](https://discourse.julialang.org/u/smickus)\
**Post date:** [September 18, 2020, 4:44am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/3 "2020-09-18T04:44:50Z")

</div>

When I use @everywhere using Optim I get the following error.

ERROR: LoadError: On worker 2:  
ArgumentError: Package Optim [429524aa-4258-5aef-a3af-852621145aeb] is required but does not seem to be installed:

- Run `Pkg.instantiate()` to install all recorded dependencies.

---

<div class="post-metadata">

**Author:** ![cricci](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cricci/32/25160_2.png) [@cricci](https://discourse.julialang.org/u/cricci)\
**Post date:** [September 18, 2020, 4:59am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/4 "2020-09-18T04:59:58Z")

</div>

while running

```julia
using Optim

```

that would run on worker 1, doesn’t run in any type of problem?

---

<div class="post-metadata">

**Author:** ![smickus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smickus/32/18002_2.png) [@smickus](https://discourse.julialang.org/u/smickus)\
**Post date:** [September 18, 2020, 5:03am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/5 "2020-09-18T05:03:08Z")

</div>

When just running on one processor the Optim packages is fucntioning.

---

<div class="post-metadata">

**Author:** ![Fliks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fliks/32/2494_2.png) [@Fliks](https://discourse.julialang.org/u/Fliks)\
**Post date:** [September 18, 2020, 7:49am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/6 "2020-09-18T07:49:52Z")

</div>

I thiink you should do

```julia
@everywhere using Pkg
@everywhere Pkg.instantiate()

```

And if you are using an environment you have to activate at every worker before you instantiate it.

---

<div class="post-metadata">

**Author:** ![BioTurboNick](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bioturbonick/32/6380_2.png) [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Post date:** [September 18, 2020, 8:20am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/7 "2020-09-18T08:20:13Z")

</div>

You may need to instantiate the workers with the correct environment. If the packages you need are in your project, you’ll want to add processes with: `addprocs(exeflags="--project")` without modification.

---

<div class="post-metadata">

**Author:** ![smickus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smickus/32/18002_2.png) [@smickus](https://discourse.julialang.org/u/smickus)\
**Post date:** [September 21, 2020, 2:46am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/8 "2020-09-21T02:46:33Z")

</div>

I wasnt quite sure what you meant. I tried this but it didn’t work:

```julia
addprocs(3, exeflags="--project")

```

---

<div class="post-metadata">

**Author:** ![smickus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/smickus/32/18002_2.png) [@smickus](https://discourse.julialang.org/u/smickus)\
**Post date:** [September 21, 2020, 2:47am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/9 "2020-09-21T02:47:33Z")

</div>

What do you mean by if I am using an environment I should instantiate it?

---

<div class="post-metadata">

**Author:** ![Jean-m\_a](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jean-m_a/32/50221_2.png) [@Jean-m\_a](https://discourse.julialang.org/u/Jean-m_a)\
**Post date:** [September 8, 2023, 9:18am UTC](https://discourse.julialang.org/t/packages-arent-found-on-worker-processors/46820/10 "2023-09-08T09:18:31Z")

</div>

I know that it is a bit late but to me the thing that worked was both to specify the exeflag and the directory of the project, because I was running the code in a notebook that was not in the same directory that my project.

```julia
addprocs(3,dir="path_to_my_project",exeflags="--project")

```
