Ask Your Question
1

Adding Sage to Jupyter Notebook on Manjaro

asked 2023-05-25 01:39:48 +0100

Unwise gravatar image

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.

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2023-05-25 13:15:47 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-05-25 13:15:17 +0100

slelievre gravatar image

updated 2023-06-06 11:01:38 +0100

Try 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 $KERNEL
edit flag offensive delete link more
0

answered 2023-05-25 09:00:51 +0100

Emmanuel Charpentier gravatar image

The 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,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2023-05-25 01:39:48 +0100

Seen: 478 times

Last updated: Jun 06 '23