-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration of kernels and extensions with jupyter #49807
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 |
}; | ||
|
||
checkInputs = [ pytest ]; | ||
propagatedBuildInputs = [ notebook metakernel gnuplot ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not somewhere hardcode a path to gnuplot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
jupyterlab
andnotebooks
has 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 where
static` directory is put).Jupyter Kernels
The environment variable
JUPYTER_PATH
is a list of:
separated paths that have akernels
directory. Every directory within contains kernelskernels/<kernel-name>/kernel.json
. Here is an examplekernel.json
.I would like to automatically add a set of kernels via the
JUPYTER_PATH
variable to thejupyterlab
andnotebook
packages. 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.json
and 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-dir
and environment variableJUPYTERLAB_DIR
that control where the extensions are installed usuallyshare/jupyter/lab
. These extensions arenpm
packages that after being combined through apackage.json
must 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 thenpm
dependencies. Currently it seems thatnpm
packages are not a good fit fornixpkgs
. So I have come up with anunpure
but 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.nix
Things 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
jupyter
derivations.sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)