# Pkg.instantiate() takes a very long time on a remote worker

**URL:** https://discourse.julialang.org/t/pkg-instantiate-takes-a-very-long-time-on-a-remote-worker/61498
**Category:** Julia at Scale
**Created:** [May 20, 2021, 7:14am UTC](https://discourse.julialang.org/t/pkg-instantiate-takes-a-very-long-time-on-a-remote-worker/61498 "2021-05-20T07:14:34Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)
#### Post date: [May 20, 2021, 7:14am UTC](https://discourse.julialang.org/t/pkg-instantiate-takes-a-very-long-time-on-a-remote-worker/61498/1 "2021-05-20T07:14:34Z")

</div>

I’m trying to use multiple nodes for a parallel algorithm, but currently `Pkg.instantiate()` takes far too long, as in 20+ minutes, so long that my 30 minute job timed out. Is there a way to speed this up? Is this normal?

---

<div class="post-metadata">

### Author: ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)
#### Post date: [May 20, 2021, 1:38pm UTC](https://discourse.julialang.org/t/pkg-instantiate-takes-a-very-long-time-on-a-remote-worker/61498/2 "2021-05-20T13:38:43Z")

</div>

So I actually have 2 problems. The first, related to the above, is that my workers do not inherit the correct `DEPOT_PATH` variable (I have to change this so as to not install julia packages in my `user` folder on the HPC I use, since we have a “data” folder we should use instead. I have now added:

```julia
Distributed.@everywhere begin 
    DEPOT_PATH[1] = "/data/leuven/331/vsc33168/.julia"
    @info "Set DEPOT_PATH = $DEPOT_PATH"
    using Pkg
    Pkg.activate(dirname(@ __FILE__ ))
    Pkg.instantiate()

    include(<path_to_script_containing_functions>)

```

The second is that Julia does not wait for `Pkg.instantiate()` to finish before continuing my script and calling `using <pkg>`, which leads to errors.

---

<div class="post-metadata">

### Author: ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)
#### Post date: [May 20, 2021, 3:56pm UTC](https://discourse.julialang.org/t/pkg-instantiate-takes-a-very-long-time-on-a-remote-worker/61498/3 "2021-05-20T15:56:33Z")

</div>

Both of these errors were fixed by setting the `DEPOT_PATH` variable on the workers. Thank you me 😛
