# Precompile to different directories

**URL:** <https://discourse.julialang.org/t/precompile-to-different-directories/10699>\
**Category:** General Usage\
**Created:** [May 4, 2018, 1:03pm UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699 "2018-05-04T13:03:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [May 4, 2018, 1:03pm UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/1 "2018-05-04T13:03:36Z")

</div>

Is it possible in Pkg2 to soecify that packages in different loadoaths precompike to different directories?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 4, 2018, 1:04pm UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/2 "2018-05-04T13:04:33Z")

</div>

You can set the `LOAD_CACHE_PATH` environment variable.

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [May 4, 2018, 1:06pm UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/3 "2018-05-04T13:06:46Z")

</div>

But that sets a single global oreconpilation path? I may need to explain the problem when I’m at a keyboard.

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [May 5, 2018, 7:22am UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/4 "2018-05-05T07:22:41Z")

</div>

So if I’ve understood the problem correctly (I’m just the messenger), then the idea is to give users of a server and of centrally managed workstations a working Julia installation _which they cannot modify_ by making JULIA\_PKGDIR read-only, but to let them install new packages in a personal folder.

But because precompilation would try to write to JULIA\_PKGDIR, this approach seems to be infeasible.

Any alternatives? Thank you.

---

<div class="post-metadata">

**Author:** ![greg\_plowman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/greg_plowman/32/8100_2.png) [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Post date:** [May 5, 2018, 9:08am UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/5 "2018-05-05T09:08:36Z")

</div>

As I understand it for Julia 0.6:

JULIA\_PKGDIR is the diredctory which `Pkg` functions use. (`Pkg.add()` installs into JULIA\_PKGDIR)

LOAD\_PATH is a list of additional (to JULIA\_PKGDIR) directories that Julia searches to find modules.

LOAD\_CACHE\_PATH is where Julia precompiles modules (from any source location)

So for your situation, one approach would be to add the centrally managed read-only package directory to LOAD\_PATH (which should be distinct from JULIA\_PKGDIR and from LOAD\_CACHE\_PATH). This will allow users to use modules from the central location but still install new packages into their personal JULIA\_PKGDIR.

---

<div class="post-metadata">

**Author:** ![cortner](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cortner/32/204_2.png) [@cortner](https://discourse.julialang.org/u/cortner)\
**Post date:** [May 5, 2018, 9:16am UTC](https://discourse.julialang.org/t/precompile-to-different-directories/10699/6 "2018-05-05T09:16:44Z")

</div>

That’s a very nie suggestion that I was slowly converging to as well. What about downloading dependencies? Is there any concern?
