Hi, I’m trying to figure out how to setup IJulia for all users on my JupyterHub server.
I know that Julia has “depots” in global locations, but I’m not sure how to install packages there. When I run Pkg.depots(), I see this:
Can someone help me out, or let me know if this is possible?
Ok, so I’m attempting to follow the instructions on this post (Julia kernel on JupyterHub system-wide LDAP - #6 by barche) and I’m running
$ JULIA_DEPOT_PATH=/opt/julia-1.4.2/share/julia sudo julia
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.2 (2020-05-23)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
(@v1.4) pkg> add IJulia
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
It looks like it’s still using the local depot. How do I get it to switch to the global one?
I’ve been trying some more stuff. With the command above, it looked like sudo was interfering with the
Base.DEPOT_PATH variable getting set. What worked was this command:
$ sudo env JULIA_DEPOT_PATH=/opt/julia-1.4.2/share/julia julia
This allowed me to install IJulia to the global depot. However, after that I had to run:
$ sudo mv ~/.local/share/jupyter/kernels/julia-1.4/ /usr/share/jupyter/kernels
so the IJulia kernel could be used globally on the system. Now the kernel works systemwide on my JupyterHub server
I’ve put together a stop-by-step guide for this:
Note though that I’m not sure this is the “best” or even a “good” solution. But it seems to work from the little testing I did so far. One issue I’m not clear about is how it will interact with updating, in particular IJulia.
See also: https://github.com/jupyterhub/the-littlest-jupyterhub/issues/279
Thanks for your post, @camtheman256, which works for Julia 1.8.1 and Jupyterhub 2.02 hosted by an LXC container that is Ubuntu-20.04-based. A little update here.
- I installed Julia to /opt/ for the ease of global availability.
sudo tar -xzf julia-1.8.1-linux-x86_64.tar.gz -C /opt/
- vim /etc/bash.bashrc
# The global Julia settings to work with Jupyterhub
Note: Here’s a Julia Pkg Server list in Chinese. If you’re not sure which one to choose, just use the official one:
- Log out and log in to make the changes applied. Install IJulia.
(@v1.8) pkg> add IJulia
- Create folders and move the Julia kernel.
sudo mkdir -p /usr/share/jupyter/kernels
sudo mv ~/.local/share/jupyter/kernels/julia-1.8/ /usr/share/jupyter/kernels/
kernel.json logo-32x32.png logo-64x64.png
- After restarting Jupyterhub or its kernel from the webpage, the Julia 1.8.1 kernel option should appear.