# Make Julia environments separation based on full version number

**URL:** <https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 14, 2019, 2:26pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537 "2019-08-14T14:26:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 14, 2019, 2:26pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/1 "2019-08-14T14:26:38Z")

</div>

I would like to make Julia installations that create different environments based on the full Julia version number. That is instead of e.g.

```julia
    ~/.julia/environments/v1.0
    ~/.julia/environments/v1.1

```

I would like to have e.g.:

```julia
    ~/.julia/environments/v1.0.1
    ~/.julia/environments/v1.0.4
    ~/.julia/environments/v1.1.0
    ~/.julia/environments/v1.1.1

```

Does anybody know how to achieve that?

Motivation: the aim is to enable full reproducibility of a certain state of a Julia application.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [August 14, 2019, 2:33pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/2 "2019-08-14T14:33:47Z")

</div>

```julia
$ export JULIA_LOAD_PATH="@:@v#.#.#:@stdlib"

```

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 14, 2019, 2:47pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/3 "2019-08-14T14:47:47Z")

</div>

Perfect, that works! thanks @fredrikekre! Just a short question for confirmation please: do I understand right that the environments that will be created that way (e.g. v1.0.1, v1.0.4, v1.1.0, v1.1.1) will be completely independent and not share anything? In particular, they will not share any package even if I install the same package e.g. for v1.0.1 and for v1.0.4?

UPDATE: it turns out that this is not a complete solution as e.g. precompiled modules are not stored based on the full version number, see below…

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [August 14, 2019, 2:55pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/4 "2019-08-14T14:55:15Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 14, 2019, 3:40pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/5 "2019-08-14T15:40:42Z")

</div>

In the Pkg documentation it says: “Pkg is designed around ‘environments’: independent sets of packages that can be local to an individual project or shared and selected by name” [1]. I understand this as follows (and quick tests seem to confirm that). If I install a same version of a package in two different environments, e.g. v1.1 and v2.0 (in the future…), then this package installation will not be duplicated: the package will be just installed once in `~/.julia/packages`, but added to both environments’ Project.toml. How can we be sure that Julia v1.1 and v2.0 will build this package the same way? Is it really safe to build it only once and share it?

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 14, 2019, 4:44pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/6 "2019-08-14T16:44:18Z")

</div>

@fredrikekre: concerning the solution that you gave: the precompile path is not changed accordingly, that is, I get e.g.

```julia
    ~/.julia/environments/v1.0.1
    ~/.julia/environments/v1.0.4

```

but then the precompiled modules are still in

```julia
    ~/.julia/compiled/v1.0

```

Do you know how we can also change the path where the precompiled modules are stored?

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [August 14, 2019, 4:49pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/7 "2019-08-14T16:49:29Z")

</div>

The current best way to do this is to change `DEPOT_PATH`

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 14, 2019, 5:01pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/8 "2019-08-14T17:01:41Z")

</div>

You mean to use a different DEPOT\_PATH for each version? But, then I would get a redundant version number in environments, e.g.:

```julia
~/.julia/v1.0.1/environments/v1.0/
~/.julia/v1.0.2/environments/v1.0/

```

This would not really be an issue besides aesthetics.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [August 16, 2019, 1:46pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/9 "2019-08-16T13:46:54Z")

</div>

> [@samo](#):
>
> will be completely independent and not share anything?

I’m curious why you want to do this. It sounds to me like you might be better off using projects explicitly instead of using the default environments.

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 16, 2019, 1:55pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/10 "2019-08-16T13:55:39Z")

</div>

You are certainly right that it is best to use explicit separate environments per project. However, I am preparing an installation on our supercomputer and we need to make sure that the default configuration is as good as possible. So we need to prevent as much as possible foreseeable problems that may occur when the user does not use explicit separate environments per project. Moreover, we need to have a maximal reproducibility of user problems in case they need help…

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [August 16, 2019, 1:59pm UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/11 "2019-08-16T13:59:30Z")

</div>

Ahh, got it. That makes sense.

---

<div class="post-metadata">

**Author:** ![samo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/samo/32/35398_2.png) [@samo](https://discourse.julialang.org/u/samo)\
**Post date:** [August 20, 2019, 8:04am UTC](https://discourse.julialang.org/t/make-julia-environments-separation-based-on-full-version-number/27537/12 "2019-08-20T08:04:49Z")

</div>

> [@samo](#):
>
> @fredrikekre: concerning the solution that you gave: the precompile path is not changed accordingly, that is, I get e.g.
> 
> ```julia
> ~/.julia/environments/v1.0.1
> ~/.julia/environments/v1.0.4
> 
> ```
> 
> but then the precompiled modules are still in
> 
> ```julia
> ~/.julia/compiled/v1.0
> 
> ```
> 
> Do you know how we can also change the path where the precompiled modules are stored?

Does anyone know how to change the path were the precompiled modules are stored?
