.julia shared

Hello everyone! My question is the following: How do I modify the location of .julia so that it is available to all users on the system? Say I choose location: /usr/local/.julia, then when a user does a pkg> add package, will that package also be available to other users? That is my intention. Thanks.

Modify JULIA_DEPOT_PATH. However, I would advise against putting a shared directory as the first entry in there since that is also used for other things such as the default package environment, REPL history, etc, that you probably don’t want users to share.

Got it, I think I will give up on this idea. But then I can use JULIA_DEPOT_PATH, to separate the versions of julia? For example:
/opt/julia-1.5.4 and ~/.julia-1.5.4
/opt/julia-1.6.0 and ~/.julia-1.6.0

Whats the point of that? The only version specific things in .julia is really the the default package environment, and that is already versioned by default.

Also, different users owning different directories and files is a recipe for a permissions nightmare

DEPOT_PATH already has versioned shared locations. Could you not just use those?

julia> DEPOT_PATH
3-element Vector{String}:
 "~/.julia"
 "~/julia-1.6.0/local/share/julia"
 "~/julia-1.6.0/share/julia"
1 Like

Ok, but the goal would be to keep the previous version available for a while and also to understand how it works.

I don’t think I know how to use it, but I’ll do it the standard way anyway.

https://docs.julialang.org/en/v1/base/constants/#Base.DEPOT_PATH

The first entry is the “user depot” and should be writable by and owned by the current user. The user depot is where: registries are cloned, new package versions are installed, named environments are created and updated, package repos are cloned, newly compiled package image files are saved, log files are written, development packages are checked out by default, and global configuration data is saved. Later entries in the depot path are treated as read-only and are appropriate for registries, packages, etc. installed and managed by system administrators.

My main goal is to keep Julia always up to date, but what about the other users? When I update Julia, they also have to update their .julia, I wish I could do this for them, but I don’t know how. If I don’t, Julia will become outdated.

~/.julia contains packages that individual users installed. User environments are versioned according major.minor. My 1.5 environment is distinct from my 1.6 environment.

You can upgrade base Julia for the users, but I really don’t recommend upgrading their environments for them. You really don’t want to be constantly updating packages without purposely doing so because code could potentially break.

1 Like

OK, thank you very much.