Launch Jupyter kernel with -e "using SomePackage" flag

Jupyter launches IJulia with julia [...options...] /path/to/IJulia/src/kernel.jl. Unfortunately, this is incompatible with -e.

The reason is that, if you run julia -e foo bar.jl, Julia executes the -e foo but ignores the bar.jl-e supersedes the file input. So, if you try to pass -e during IJulia launch, it won’t execute IJulia itself.

(I’m not sure why julia behaves this way; it would make more sense to me to execute both the -e command and the file. Maybe this could be changed in a future release.)

1 Like