Integration of kernels and extensions with jupyter#49807
Integration of kernels and extensions with jupyter#49807costrouc wants to merge 21 commits intoNixOS:masterfrom
Conversation
|
You have seen the top-level |
|
I had not seen that before and thank you for pointing that out! However, I see some issues with declaring this in I have learned that the |
The NixOS module only provides an interface and a service, but the actual logic for running a notebook with specified kernels is implemented in the two top-level attributes I referred to. |
|
Original PR #33673 |
|
Thank you and I should read more carefully the expressions. next time. I will try it out with the new kernels with the derivations and also would be interested in adding extensions support to the |
There was a problem hiding this comment.
Should we not somewhere hardcode a path to gnuplot?
There was a problem hiding this comment.
Yes we should. Currently I am trying to get the gnuplot_kernel to work. It freezes on me for an unknown reason.
This should be easy to achieve by adding a
|
cbad6bc to
f6177a9
Compare
14f120f to
5a81da3
Compare
|
Here is the error I get (due to using python2.7 for 3 packages) |
fc9bc5f to
6ac8cf3
Compare
|
@veprbl I am not very knowledgeable on how to properly do this. Could you give some further advice? Additionally I should state that jupyterlab kernels are not necessarily for python only. For example this PR adds support for |
|
I would like some feedback of using ...
passthru ={
jupyterlabExtensions = [ "jupyterlab-datawidgets" "@jupyter-widgets/jupyterlab-manager
" ];
};
...Is the correct way to pass that the package requires an (pkgs.lib.unique
((pkgs.lib.concatMap
(d: pkgs.lib.attrByPath ["passthru" "jupyterlabExtensions"] [] d)
buildInputs) ++ additionalExtensions)) |
|
I was unaware of edit: @MMesch after looking more carefully https://github.com/jupyterlab/jupyterlab/blob/master/jupyterlab/commands.py#L659-L684 it looks link This PR is still ready for merge. |
Extensions: - ipyvolume - @jupyter-widgets/jupyterlab-manager - @jupyterlab/fasta-extension - @jupyterlab/geojson-extension - @jupyterlab/git - @jupyterlab/hub-extension - @jupyterlab/katex-extension - @jupyterlab/latex - @jupyterlab/mathjax3-extension - @jupyterlab/plotly-extension - @jupyterlab/toc - @jupyterlab/vega2-extension - @jupyterlab/vega3-extension - @jupyterlab/xkcd-extension - jupyter-leaflet - jupyter-matplotlib - jupyter-threejs - jupyter-webrtc - jupyterlab-datawidgets - jupyterlab-drawio
|
agree. I'll help you with the other PR ... |
a6fb7ce to
436bba0
Compare
|
Success on aarch64-linux (full log) Attempted: gophernotes Partial log (click to expand)
|
|
Success on x86_64-linux (full log) Attempted: gophernotes Partial log (click to expand)
|
|
I will also be closing this along with two other PRs to combine with this one. #49807, #49721, and #50858. This will lead to a PR with better python 3 support for jupyter (newest releases are python 3.5+ only). Addition of 3 kernels (c, go, ansible) and 20 jupyterlab extensions. Also will have an editor that has a clean way to add kernels and extensions. This will be a big PR but I am finding that they all depend on each other. |
Did the new PR land? Related: it appears similar functionality can be found in the JupyterWith repo. |
Motivation for this change
this main comment has been edited to reflect progress
Anyone who has used
jupyterlabandnotebookshas run into the issue of adding kernels and extensions to the UI. This is tricky because often times the kernels run in a different language e.g.julia,haskell, etc. Nix can handle this extremely well and would make jupyter notebook installations much easier. This PR provides intructions on a way to "auto-installkernels and extensions into the nix environment. Any input would be much appreciated. Here is what my research has shown me so far (I dont understand extensions yet wherestatic` directory is put).Jupyter Kernels
The environment variable
JUPYTER_PATHis a list of:separated paths that have akernelsdirectory. Every directory within contains kernelskernels/<kernel-name>/kernel.json. Here is an examplekernel.json.{ "argv":["/nix/store/bwfygfcdvis9wd1c1v51xwnwhw1hx0a0-python3-3.6.6/bin/python3.6m","-m","jupyter_c_kernel","-f","{connection_file}"], "display_name":"C", "language":"c" }I would like to automatically add a set of kernels via the
JUPYTER_PATHvariable to thejupyterlabandnotebookpackages. Not sure exactly how to do this here is an example of me setting the variable after the fact in anix-shell. It has been show below how to automatically do this but the issue is that kernels exist for many languages not just python. What I have settled on is thatkernel.jsonand the images should be included atshare/jupyter/kernels/<kernel-name>/.JupyterLab Extensions
Jupyterlab is the future so I have put the most effort into installation instructions. Additionally
notebook's installation paths are not as well documented and often times work without any additional steps. Jupyterlab has a command line option--app-dirand environment variableJUPYTERLAB_DIRthat control where the extensions are installed usuallyshare/jupyter/lab. These extensions arenpmpackages that after being combined through apackage.jsonmust be "compiled" with webpack to produce compressed static files. The npm package dependencies can easily be in the thousands... thanks Javascript leading to about 100MB - 1GB of dependencies that must be compiled for each additional extension added. This step cannot be pure unless we override the jupyterlab package management and handle all of thenpmdependencies. Currently it seems thatnpmpackages are not a good fit fornixpkgs. So I have come up with anunpurebut working way to package jupyterlab extensions. Each package that comes with a jupyterlab extension usespassthru = { jupyterlabExtensions = [ .... ]; };. Then we include the following linesWorking Example with 20 jupyerlab extension + 4 kernels (c, python, go, ansible)
All that needs to be edited by user is
kernels,additionalExtensions, andbuildInputs. The rest is automatic and will launch a jupyterlab instance for you.shell.nixThings done
Not all of these kernels work currently (gnuplot, zeus-cling)
Adding four kernels:
Want to add extension support for python/jupyterlab extension:
This will require input on how to properly include extensions and kernels within
jupyterderivations.sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)