How does one set up a centralized Julia installation?

I’ve been bashing my head off a wall with this for many hours now. My use case it trying to get Jupyterhub working as a web interface for many users to access Julia. This requires installing the IJulia package in such a way that it is accessible for all users without them first having to SSH in to install it.

I used to be able to do this on v0.6-ish by using the JULIA_PKGDIR environment variable to point to a central directory before installing as root, then adding the same path to the LOAD_PATH julia variable via juliarc.jl – basically what is now referred to as “Old Post” here: server - Install just one package globally on Julia - Stack Overflow

But, this workflow is broken in v1.0 …

I’ve tried replacing JULIA_PKGDIR with JULIA_DEPOT_PATH as suggested in that updated Stack Overflow post, but this creates a lot more than just a package directory in that location (it seems to setup a whole project environment for the root user in the central location). LOAD_PATH then no longer seems to pick that up, so I have to add to the DEPOT_PATH via the startup.jl script and also chmod the directory structure created in that location to be readable by all. These are the steps:

sudo mkdir -p /opt/julia-packages/
sudo sh -c "echo 'push!(DEPOT_PATH, \"/opt/julia-packages/\")' >> /usr/etc/julia/startup.jl"
sudo JULIA_DEPOT_PATH=/opt/julia-packages/ julia -e 'using Pkg; Pkg.add("IJulia")'
sudo chmod -R uog+r /opt/julia-packages

This then works … sort of. It is basically enough to be able to load the Julia 1.0 kernel in Jupyterhub, but if you try to install a package as a user, then contrary to the documentation (which states that all depots except the first are read-only) it tries to install the package in both ~/.julia and in the central depot where IJulia was installed and obviously fails as non-root can’t write there.

Any insights greatly appreciated, because I’m on the point of giving up and removing this feature from my community project.

7 Likes