ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 25 May 2023 13:15:47 +0200Adding Sage to Jupyter Notebook on Manjarohttps://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/ Hello. I have a working install of Jupyter Notebook, and I just got Sagemath 9.8-2 from the Arch community repo. Following the docs, I should be able to add the Sage kernel to the existing Jupyter install by running the command `sudo jupyter kernelspec install $SAGE_LOCAL/share/jupyter/kernels/sagemath`.
However, this only returns the following error: `No such file or directory: '/share/jupyter/kernels/sagemath'`. The variable `$SAGE_LOCAL` doesn't seem to be defined, and I'm having trouble finding the correct path manually. I tried with `which sage` which tells me the executable is in `/usr/bin`, but it didn't help me much with the issue.Thu, 25 May 2023 01:39:48 +0200https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/Comment by slelievre for <p>Hello. I have a working install of Jupyter Notebook, and I just got Sagemath 9.8-2 from the Arch community repo. Following the docs, I should be able to add the Sage kernel to the existing Jupyter install by running the command <code>sudo jupyter kernelspec install $SAGE_LOCAL/share/jupyter/kernels/sagemath</code>. </p>
<p>However, this only returns the following error: <code>No such file or directory: '/share/jupyter/kernels/sagemath'</code>. The variable <code>$SAGE_LOCAL</code> doesn't seem to be defined, and I'm having trouble finding the correct path manually. I tried with <code>which sage</code> which tells me the executable is in <code>/usr/bin</code>, but it didn't help me much with the issue.</p>
https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?comment=68718#post-id-68718Welcome to Ask Sage! Thank you for your question!Thu, 25 May 2023 13:15:47 +0200https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?comment=68718#post-id-68718Answer by slelievre for <p>Hello. I have a working install of Jupyter Notebook, and I just got Sagemath 9.8-2 from the Arch community repo. Following the docs, I should be able to add the Sage kernel to the existing Jupyter install by running the command <code>sudo jupyter kernelspec install $SAGE_LOCAL/share/jupyter/kernels/sagemath</code>. </p>
<p>However, this only returns the following error: <code>No such file or directory: '/share/jupyter/kernels/sagemath'</code>. The variable <code>$SAGE_LOCAL</code> doesn't seem to be defined, and I'm having trouble finding the correct path manually. I tried with <code>which sage</code> which tells me the executable is in <code>/usr/bin</code>, but it didn't help me much with the issue.</p>
https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?answer=68717#post-id-68717Try the following:
$ sage -c 'print(SAGE_LOCAL)'
If this prints out a directory, replace the command in your question by
$ KERNEL=$(sage -c 'print(SAGE_LOCAL)')/share/jupyter/kernels/sagemath
$ sudo jupyter kernelspec install $KERNELThu, 25 May 2023 13:15:17 +0200https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?answer=68717#post-id-68717Answer by Emmanuel Charpentier for <p>Hello. I have a working install of Jupyter Notebook, and I just got Sagemath 9.8-2 from the Arch community repo. Following the docs, I should be able to add the Sage kernel to the existing Jupyter install by running the command <code>sudo jupyter kernelspec install $SAGE_LOCAL/share/jupyter/kernels/sagemath</code>. </p>
<p>However, this only returns the following error: <code>No such file or directory: '/share/jupyter/kernels/sagemath'</code>. The variable <code>$SAGE_LOCAL</code> doesn't seem to be defined, and I'm having trouble finding the correct path manually. I tried with <code>which sage</code> which tells me the executable is in <code>/usr/bin</code>, but it didn't help me much with the issue.</p>
https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?answer=68713#post-id-68713The `SAGE_`... environment variables are defined by the `sage` executable (which is in fact a shell script), hence undefined in the "standard" enviroinment. You can work in Sage's environment thanks to `sage -sh` (look it up !).
Compare :
charpent@zen-book-flip:~$ echo $SAGE_LOCAL
(which prints nothing) with
charpent@zen-book-flip:~$ sage -sh -c 'echo $SAGE_LOCAL'
/usr/local/sage-10/local
HTH,Thu, 25 May 2023 09:00:51 +0200https://ask.sagemath.org/question/68708/adding-sage-to-jupyter-notebook-on-manjaro/?answer=68713#post-id-68713