Hi, IJulia doesn’t work on my system, Ubuntu LTS 20.04. The (bash) command jupyter notebook works fine, but I don’t see julia when I press the “new” button. So I launched julia REPL and tried :
julia> using IJulia
julia> notebook()
[ Info: running `/usr/bin/snap notebook`
Process(setenv(`/usr/bin/snap notebook`; dir="/home/betrema"), ProcessExited(64))
Why the hell does jupyter disappear from this short log? The answer looks simple, let us return to bash:
[~]which jupyter
/snap/bin/jupyter
[~]ls -l /snap/bin/jupyter
lrwxrwxrwx 1 root root 13 mars 23 17:01 /snap/bin/jupyter -> /usr/bin/snap
and yet the two commands (source and target of the link) give different results with argument notebook! This situation left me wondering, until I thought of the argument argv[0] of a C program, that is the name of the command, and some testing confirmed that this name is different when we use a link. Here usr/bin/snap is a kind of dispatcher among snap packages, using name of the link “source”.
Some investigation on //github.com/JuliaLang/IJulia.jl shows:
function find_jupyter_subcommand(subcommand::AbstractString)
[...]
jupyter = Sys.which(exe("jupyter"))
[...]
end
and returning to the REPL I got the bad answer:
julia> Sys.which("jupyter")
"/usr/bin/snap"
The code of the function Sys.which() uses the function realpath(), that canonicalize a path by expanding symbolic links […]
The lesson of this story is that the julia function Sys.which() should not return another path than the (very useful) linux command which.
PS Please, don’t tell me to install jupyter with another package manager (as in the post Need Help with IJulia on Ubuntu 18.04.5 LTS), snap has been standard for some years.