Julia kernel on JupyterHub system-wide LDAP

Hello,

OS : Debian 9.5
Julia : Version 1.0
I’m trying to make Julia kernel work on my JupyterHub. I need the kernel to work for multiple users and not only for the local user / root. I configured JupyterHub with an LDAP authentificator and works fine.
Here is what i’have done at the moment and the error that i’m getting :

[user@serv:~]$ tar xvf julia-1.0.0-linux-x86_64.tar.gz
[user@serv:~]$ sudo mv julia-*/ /opt/
[user@serv:~]$ sudo ln -s /opt/julia-*/bin/julia /usr/local/bin/julia
[user@serv:~]# source activate jupenv
(jupenv) [user@serv:~]# julia
julia> using Pkg
julia> Pkg.add("IJulia")
   Cloning default registries into /root/.julia/registries
   Cloning registry General from "https://github.com/JuliaRegistries/General.git"
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed Conda ─────────── v1.0.1
 Installed IJulia ────────── v1.11.1
 Installed Compat ────────── v1.1.0
 Installed MbedTLS ───────── v0.6.0
 Installed BinaryProvider ── v0.4.2
 Installed VersionParsing ── v1.1.2
 Installed ZMQ ───────────── v1.0.0
 Installed SoftGlobalScope ─ v1.0.4
 Installed JSON ──────────── v0.19.0
  Updating `~/.julia/environments/v1.0/Project.toml`
  [7073ff75] + IJulia v1.11.1
  Updating `~/.julia/environments/v1.0/Manifest.toml`
  [b99e7846] + BinaryProvider v0.4.2
  [34da2185] + Compat v1.1.0
  [8f4d0f93] + Conda v1.0.1
  [7073ff75] + IJulia v1.11.1
  [682c06a0] + JSON v0.19.0
  [739be429] + MbedTLS v0.6.0
  [b85f4697] + SoftGlobalScope v1.0.4
  [81def892] + VersionParsing v1.1.2
  [c2297ded] + ZMQ v1.0.0
  [2a0f44e3] + Base64 
  [ade2ca70] + Dates 
  [8bb1440f] + DelimitedFiles 
  [8ba89e20] + Distributed 
  [7b1f6079] + FileWatching 
  [b77e0a4c] + InteractiveUtils 
  [76f85450] + LibGit2 
  [8f399da3] + Libdl 
  [37e2e46d] + LinearAlgebra 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [a63ad114] + Mmap 
  [44cfe95a] + Pkg 
  [de0858da] + Printf 
  [3fa0cd96] + REPL 
  [9a3f8284] + Random 
  [ea8e919c] + SHA 
  [9e88b42a] + Serialization 
  [1a1011a3] + SharedArrays 
  [6462fe0b] + Sockets 
  [2f01184e] + SparseArrays 
  [10745b16] + Statistics 
  [8dfed614] + Test 
  [cf7118a7] + UUIDs 
  [4ec0a83e] + Unicode 
  Building Conda ──→ `~/.julia/packages/Conda/m7vem/deps/build.log`
  Building ZMQ ────→ `~/.julia/packages/ZMQ/ABGOx/deps/build.log`
  Building MbedTLS → `~/.julia/packages/MbedTLS/Qo8TN/deps/build.log`
  Building IJulia ─→ `~/.julia/packages/IJulia/k5o7j/deps/build.log`
[user@serv:~]# mkdir /usr/local/share/jupyter/kernels/julia-1.0.0
[user@serv:~]# cp /home/user/.julia/packages/IJulia/k5o7j/src/kernel.jl /usr/local/share/jupyter/kernels/julia-1.0.0/
[user@serv:~]# cp /home/user/.local/share/jupyter/kernels/julia-1.0/kernel.json /usr/local/share/jupyter/kernels/julia-1.0.0/
[user@serv:~]# cp /home/user/.local/share/jupyter/kernels/julia-1.0/logo-32x32.png /usr/local/share/jupyter/kernels/julia-1.0.0/
[user@serv:~]# cp /home/user/.local/share/jupyter/kernels/julia-1.0/logo-64x64.png /usr/local/share/jupyter/kernels/julia-1.0.0/
[user@serv:~]# nano /usr/local/share/jupyter/kernels/julia-1.0.0/kernel.json

{
  "display_name": "Julia 1.0.0",
  "argv": [
    "/opt/julia-1.0.0/bin/julia",
    "-i",
    "--startup-file=yes",
    "--color=yes",
    "/usr/local/share/jupyter/kernels/julia-1.0.0/kernel.jl",
    "{connection_file}"
  ],
  "language": "julia"
}

Error that JupyterHub displays :

ERROR: LoadError: ArgumentError: Package IJulia not found in current path:
- Run `Pkg.add("IJulia")` to install the IJulia package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:817
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include(::Module, ::String) at ./sysimg.jl:29
 [5] exec_options(::Base.JLOptions) at ./client.jl:229
 [6] _start() at ./client.jl:421
in expression starting at /usr/local/share/jupyter/kernels/julia-1.0.0/kernel.jl:1

I would like to know the right way to make the Julia kernel work on JupyterHub and make it work for all users with out errors or crashs.

Best regards.

1 Like

@New1nd, from, https://docs.julialang.org/en/v1.0.0/stdlib/Pkg/#Pkg.add, The Pkg REPL-mode is entered from the Julia REPL using the key ]. Once there, try to add IJulia again with the command add IJulia.

@svaksha

(v1.0) pkg> add IJulia
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.0/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v1.0/Manifest.toml`
 [no changes]

While running JupyterHub when i want to use Julia kernel i still got the same error :

ERROR: LoadError: ArgumentError: Package IJulia not found in current path:
- Run `Pkg.add("IJulia")` to install the IJulia package.

Stacktrace:
 [1] require(::Module, ::Symbol) at ./loading.jl:817
 [2] include at ./boot.jl:317 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:1038
 [4] include(::Module, ::String) at ./sysimg.jl:29
 [5] exec_options(::Base.JLOptions) at ./client.jl:229
 [6] _start() at ./client.jl:421
in expression starting at /usr/local/share/jupyter/kernels/julia-1.0.0/kernel.jl:1

Is the first installation command running as the same user as the jupyterhub notebook? I am using jupyterhub with a docker image for the user servers, I can share the Dockerfile if this would be a solution for you.

@barche No it isn’t. When i launch the JupyterHub server only for the local users on the system, everything works fine. When i launch it with an LDAP authenticator configuration, users can only run Python and R kernels, JupyterHub displays that IJulia is not installed when a user wants to use Julia kernel.

I would like to make the Julia kernel work system-wide like Python and R. In R you can do this command installspec(user = FALSE) to make it work system-wide. What can i do to make something equivalent to that command with an LDAP configuration ?

Here is my JupyterHub configuration for a better understanding :

c.LDAPAuthenticator.bind_dn_template = '***********************'
c.LDAPAuthenticator.user_search_base = '******************'
c.LDAPAuthenticator.user_attribute = '******************'
c.LDAPAuthenticator.server_address = '*******************'
c.LDAPAuthenticator.lookup_dn = False
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = '*************************'
c.LDAPAuthenticator.escape_userdn = False

c.LocalAuthenticator.create_system_users = True
c.LocalAuthenticator.add_user_cmd =  ['adduser', '-q', '--home', '/students/USERNAME', '--gecos', '""', '--disabled-password', '--force-badname']

c.JupyterHub.allow_named_servers = False
c.JupyterHub.authenticator_class = 'ldapauthenticator.ldapauthenticator.LDAPLocalAuthenticator'
c.JupyterHub.bind_url = '******************'
c.JupyterHub.default_url = '/hub/home'
c.JupyterHub.proxy_class = 'jupyterhub.proxy.ConfigurableHTTPProxy'
c.JupyterHub.ssl_cert = '/etc/ssl/**************.******.crt'
c.JupyterHub.ssl_key = '/etc/ssl/*******.key'
c.JupyterHub.subdomain_host = '*******************'

c.Spawner.default_url = '/tree'

c.Authenticator.admin_users = ['*****', '***********', '**********']

I think you can use the JULIA_DEPOT_PATH environment variable (documentation) for that. If you set this to a globally visible location (e.g. /opt/julia-depot or something) when installing IJulia from the console, it should install everything there. For the ldap users, you then need to make sure this path is appended to JULIA_DEPOT_PATH, since the first entry is expected to be a user-writable location.

@barche Thank you. It works fine now. :ok_hand: