Opened 23 months ago
Last modified 3 weeks ago
#30120 new defect
Sage's jupyter doesn't "talk" to a systemwide IRkernel R package
Reported by: | charpent | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.7 |
Component: | notebook | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #30124 | Stopgaps: |
Description
TL:DR : Sage's Jupyter cannot use a systemwide R IRkernel (correctly installed and usable from a systemwide jupyter notebook).
Current situation :
- Sage 9.2.beta4 compiled on Linux (Debian testing) from the source tree, configured to use systemwide packages (including R).
- Jupyter : installed from Debian packages
- jupyter core : 4.6.3
- jupyter-notebook : 6.0.3
- R: 4.0.2, as obtained from Debian testing.
- IRkernel : 1.1, installed from CRAN
Kernels:
charpent@zen-book-flip:~$ jupyter kernelspec list Available kernels: ir /usr/local/share/jupyter/kernels/ir python3 /usr/share/jupyter/kernels/python3 charpent@zen-book-flip:~$ sage -jupyter kernelspec list Available kernels: python3 /usr/local/sage-9/local/share/jupyter/kernels/python3 sagemath /usr/local/sage-9/local/share/jupyter/kernels/sagemath ir /usr/local/share/jupyter/kernels/ir
Symptoms :
- On the systemwide Jupyter notebook (started with
jupyter notebook
], the R kernel behaves normally :- R appears on the list of available kernelsa new tab
- an R sheet can be created from the relevant menu, behaves normally, and can be saved/reopened.
- On the Sage notebook (
sage -n jupyter
) :- R appears on the list of available kernels
- when (attempting to) create a new sheet :
- the browser switches to a new tab, thar remains empty
- Nothing else happens
- When closing this new tab and switching back to Jupyter's "directory" tab, a new file ("Untitled.ipynb") is listed as having been created.
Attempts to install the r_jupyter
spkg failed :
- As a normal user : because it can't write to the systemwide R library, owned by
root
- As root, because Sage can't be built by a privileged user.
The availability of R from Sage's notebook should reduce the need for the systemwide Jupyter(ditto for the other Sage-created Jupyter kernels).
Alternatively, the availability of the Sage kernel from the systemwide notebook would reduce (eliminate ?) the need for Sages's Jupyter (this currently fails, the documentation can't be found during kernel's installation).
Sidenote : the r_jupyter
spkg downloads the Github version of IRkernel
. This is outdated, IRkernel
being on CRAN since late 2019 : this version should probably be preferred, if only for stability/availability reasons
Change History (12)
comment:1 follow-up: ↓ 2 Changed 23 months ago by
comment:2 in reply to: ↑ 1 Changed 23 months ago by
Replying to slelievre:
Workaround: install Sage's Jupyter kernel in systemwide Jupyter installation.
$ JUPTER_KERNELS=/path/to/jupyter/kernels $ SAGE_LOCAL=`$ sage -c "print(SAGE_LOCAL)"` $ SAGE_KERNEL=$SAGE_LOCAL/share/jupyter/kernels/sagemath $ ln -s $SAGE_KERNEL $JUPYTER_KERNELS
Thanks ! This works.
To find out what to use for
/path/to/jupyter/kernels
:$ jupyter kernelspec list
A bashism to find this programatically is :
jupyter kernelspec list| grep python3 | sed -re "s/[ \t]+/ /g" | cut -d " " -f 3 | sed "s/\/python3//"
If this can be generalized to our other supported platforms, this might allow to dispense with Jupyter in sage-the-distribution, in line with the current effort to (be able to) use a maximum of systemwide tools.
See also:
- sage-devel: Installing sage as a kernel in the system-wide jupyter, tip posted by Nils Bruin
- Stack Overflow: Install SageMath kernel in Jupyter, especially answer by user "Layek"
Interesting.
Do you think that this ticket should be :
- Left open to allow someone to work on the use of external kernels with Sage ;
- Closed as invalid (if we move to "external" jupyter
- Be reworked to patch this "external" jupyter solution into Sage itself ?
Thank you again !
comment:3 follow-up: ↓ 5 Changed 23 months ago by
Do you think that this ticket should be:
- Left open to work on using external kernels with Sage
- Closed as invalid (if we move to "external" jupyter)
- Be reworked to patch this "external" jupyter solution into Sage itself?
Document symlinking Jupyter kernels both ways between systemwide Jupyter and Sage's one.
Did you try symlinking the other way, i.e. find the
IRkernel from your systemwide Jupyter and add a symlink
to it in $SAGE_LOCAL/share/jupyter/kernels
?
comment:4 Changed 23 months ago by
Related:
- #30124: spkg-configure.m4 for jupyter
comment:5 in reply to: ↑ 3 Changed 23 months ago by
Replying to slelievre:
[ Snip... ]
Did you try symlinking the other way, i.e. find the IRkernel from your systemwide Jupyter and add a symlink to it in
$SAGE_LOCAL/share/jupyter/kernels
?
I tried that (documented in the description), and it doesn't work (same symptoms as with "normal" installation : R appears in the menu for "new sheet", opens a new (blank) tab, that remains totally inactive. No sifgn of life in the cosole where I have done "sagemath -n jupyter" either).
comment:6 Changed 22 months ago by
Have you tried to set JUPYTER_PATH
in the sage environment to point to the folder where the system's kernel are located?
https://jupyter-client.readthedocs.io/en/stable/kernels.html
comment:7 Changed 22 months ago by
- Dependencies set to #30124
comment:8 Changed 22 months ago by
- Milestone changed from sage-9.2 to sage-9.3
comment:9 Changed 16 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
comment:10 Changed 10 months ago by
- Milestone changed from sage-9.4 to sage-9.5
comment:11 Changed 5 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:12 Changed 3 weeks ago by
- Milestone changed from sage-9.6 to sage-9.7
Workaround: install Sage's Jupyter kernel in systemwide Jupyter installation.
To find out what to use for
/path/to/jupyter/kernels
:$ jupyter kernelspec list
See also: