# Production Package Installation Process - Install with user 'a', Access from user 'b'

**URL:** <https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422>\
**Category:** New to Julia\
**Tags:** question, package\
**Created:** [May 13, 2020, 6:45pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422 "2020-05-13T18:45:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![eyedia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eyedia/32/14434_2.png) [@eyedia](https://discourse.julialang.org/u/eyedia)\
**Post date:** [May 13, 2020, 6:45pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/1 "2020-05-13T18:45:46Z")

</div>

Here is the steps on production environment (Very standard)

1. Deployment process [one time task]: Copy source code and install all packages → this is done by sudo user, lets say “sshuser”
2. Run time our packages are executed by another service account user → let say “service\_user”

In my case user #2 never find the packages installed by user #1

How can I have common environment for both users?

Thanks everyone!

---

<div class="post-metadata">

**Author:** ![bjarthur](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bjarthur/32/9638_2.png) [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Post date:** [May 13, 2020, 11:34pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/2 "2020-05-13T23:34:21Z")

</div>

before installing packages in step 1, do a `popfirst!(DEPOT_PATH)`

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 14, 2020, 6:31am UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/3 "2020-05-14T06:31:25Z")

</div>

If you want to freeze all packages (as per your previous thread) and don’t need users changing anything in the environment, you might consider using PackageCompiler to simply compile all packages into the sysimage - which would also give you quicker startup times!

---

<div class="post-metadata">

**Author:** ![avik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/avik/32/17_2.png) [@avik](https://discourse.julialang.org/u/avik)\
**Post date:** [May 14, 2020, 9:29am UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/4 "2020-05-14T09:29:16Z")

</div>

To expand on what @bjarthur said, the location where packages are installed are defined using a variable called `DEPOT_PATH`. It can be a list of paths, where packages are written to the first element of the list, and read from all the paths in the list.

So on my machine, the default depot path is as follows:

```julia
julia> DEPOT_PATH
3-element Array{String,1}:
 "/home/user/.julia"
 "/opt/dev/julia-1.1.0/local/share/julia"
 "/opt/dev/julia-1.1.0/share/julia"

```

So if you `popfirst!(DEPOT_PATH)`, then your packages will get installed in a location inside your julia install directory, rather than in the user’s home dir.

Now, given this, you can of course set your `DEPOT_PATH` to any other location on your disk. When you set it from the shell, the environment variable is called `JULIA_DEPOT_PATH`. To see an example of an install script that does that, [look here](https://github.com/dfdx/Spark.jl/blob/master/examples/InstallJuliaHDI.sh#L35)

Note that generally you would want to make the `DEPOT_PATH` writeable by any user that runs Julia, since the results of package precompilation (and artifacts) are written to the `DEPOT_PATH`. For similar reasons, you should not run multiple julia processes simultaneously looking at the same `DEPOT_PATH` while packages are precompiling. The solution to both is to ensure your packages are precompiled and loaded at install time (with `Pkg.precompile()` and/or `using`). Or just run your testsuite at install time.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 14, 2020, 9:41am UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/5 "2020-05-14T09:41:04Z")

</div>

To set your DEPOT\_PATH and other environment variables, consider using Modules.

[https://lmod.readthedocs.io/en/latest/](https://lmod.readthedocs.io/en/latest/)

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 14, 2020, 9:55am UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/6 "2020-05-14T09:55:34Z")

</div>

Also worth looking at easybuild [EasyBuild: building software with ease](https://easybuilders.github.io/easybuild/)  
ans Spack  
I found an Easyblock which says it installs Julia packages, but seems a bit out of date  
[CSCS/julia.py at master · easybuilders/CSCS · GitHub](https://github.com/easybuilders/CSCS/blob/master/easybuild/easyblocks/julia.py)

---

<div class="post-metadata">

**Author:** ![eyedia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eyedia/32/14434_2.png) [@eyedia](https://discourse.julialang.org/u/eyedia)\
**Post date:** [May 14, 2020, 3:54pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/7 "2020-05-14T15:54:06Z")

</div>

Thanks @bjarthur for the quick solution & @avik for the explanation. I tried on my machine and got the concept. Problem is everything works on my machine 😂

I will try both styles(popfirst and setting JULIA\_DEPOT\_PATH) on Servers (Linux environment) and update this ticket, but will take some time.

@nilshg - The sysimage is some kind of Julia package image? Complete OS image is not a solution for me.

@johnh - thanks, will look into

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 14, 2020, 3:56pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/8 "2020-05-14T15:56:02Z")

</div>

Yes it’s basically a version of Julia with the packages you’re using built-in, similar to the standard library - so the same way you can just do `using LinearAlgebra` in a fresh Julia install without having to install package, you could do that for every package in your sysimage.

---

<div class="post-metadata">

**Author:** ![eyedia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eyedia/32/14434_2.png) [@eyedia](https://discourse.julialang.org/u/eyedia)\
**Post date:** [May 14, 2020, 3:57pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/9 "2020-05-14T15:57:15Z")

</div>

@nilshg Wow! Thats nice. Can you direct me to some example/docs?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [May 14, 2020, 4:05pm UTC](https://discourse.julialang.org/t/production-package-installation-process-install-with-user-a-access-from-user-b/39422/10 "2020-05-14T16:05:58Z")

</div>

I think the docs are pretty good (NB: I haven’t tried it myself though!): [Home · PackageCompiler](https://julialang.github.io/PackageCompiler.jl/dev/)
