# Distributed Sampling with Turing with project environment

**URL:** <https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368>\
**Category:** General Usage\
**Created:** [April 15, 2021, 7:46pm UTC](https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368 "2021-04-15T19:46:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdeonovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bdeonovic/32/3928_2.png) [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Post date:** [April 15, 2021, 7:46pm UTC](https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368/1 "2021-04-15T19:46:18Z")

</div>

I have some code in a project (that I setup with DrWatson.jl but I don’t think that is too important). I try to get Turing available on all procs with

```julia
using Turing
using Distributed

addprocs(4)

@everywhere using DrWatson
@everywhere @quickactivate "IBUGS"
@everywhere using Turing

```

(the quickactivate just activates the project environment on each proc as far as I know). It seems like each proc wants to re-precompile Turing and I get an error. Is there better way to do this?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [April 16, 2021, 4:18pm UTC](https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368/2 "2021-04-16T16:18:39Z")

</div>

1. Precompile the environment before trying to use it everywhere.
2. Activate the environment first

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [April 16, 2021, 5:51pm UTC](https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368/3 "2021-04-16T17:51:24Z")

</div>

If the advice given by mkitti does not work, can you post your error message?

---

<div class="post-metadata">

**Author:** ![bdeonovic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bdeonovic/32/3928_2.png) [@bdeonovic](https://discourse.julialang.org/u/bdeonovic)\
**Post date:** [April 16, 2021, 7:43pm UTC](https://discourse.julialang.org/t/distributed-sampling-with-turing-with-project-environment/59368/4 "2021-04-16T19:43:52Z")

</div>

I thought I had done that. I did it again to grab the error message but now it worked. So who knows!

EDIT: hold on i forgot to addprocs this time.
