Jupyter and Jupytext through IJulia.jl (Jupytext does not really work)

jupyter / jupyter-lab / jupyter-lab (howto)

Installing jupyter by means of IJulia seems like a trap. If I do it, I am not able to make jupytext work with jupyter-notebook or jupyter-lab. So what worked for me follows.

  • In any folder you can run:
    • sudo aura -A miniconda3 # aura is my AUR package installer, use yours instead
    • sudo ln -s /opt/miniconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
    • echo "[ -f /opt/miniconda3/etc/profile.d/conda.sh ] && source /opt/miniconda3/etc/profile.d/conda.sh" >> ~/.bashrc # I use bash, if you use zsh adapt
  • Reopen the terminal, so it updates the variables, and then run in any folder:
    • conda create -n myenv jupyter jupytext # you can give a better name than myenv
    • conda activate myenv # not sure if the next steps need conda activated, but we will keep it for the rest of the steps
  • The IJulia is still needed to create the Julia Kernel. If you install it locally to an environment (like I do, I never install packages to the global Julia environment), you will need to put the path to the environment in the kernel specification (and basically use one kernel per project).
  • So in the folder that you will use as environment for the Julia notebooks do:
    • julia --project=. -e 'using Pkg: Pkg; Pkg.add("IJulia");' # will not ask to install jupyter this way, if it asks then refuse
    • julia --project=. -e 'using IJulia: IJulia; IJulia.installkernel("Julia My Kernel Name", "-O2", "--project=$(pwd())", env=Dict("LD_LIBRARY_PATH" => ""))' # the LD_LIBRARY_PATH=“” comes from an annoying bug of Julia in Arch Linux
  • And then finally:
    • jupyter-lab