2020-05-06 17:58:09 UTC, Szabolcs Horvát:
>
> I use sage 9.0 and sage 8.9 on macOS. I compiled them
> myself so I would gain access to other ILP solvers than GLPK.
>
> They work fine in command line mode. But if I start Sage 9.0
> as sage --notebook, it gives me an interface to create a new
> notebook, which only has the kernel "Sage 8.9".  How can
> I get the Sage 9.0 kernel?
>
> This help page is not helpful:
>
> 
https://doc.sagemath.org/html/en/reference/repl/sage/repl/ipython_kernel/install.html
>
> It does not explain how to install the kernel.

Building several versions of SageMath on macOS
does not seem to install a Jupyter kernel for each,
maybe because each new build sees a Jupyter kernel
for Sage already exists at the desired location.

Maybe this is something we should improve. In any
case thanks for asking, and here are, at least,
some ways to sort this out "by hand".

To figure out where your kernels are installed, run:

    $ sage --jupyter kernelspec list

This might answer something like:

    Available kernels:
      python3     /Users/name/Library/Jupyter/kernels/python3
      sagemath    /Users/name/Library/Jupyter/kernels/sagemath

To change what the SageMath kernel is doing, you can edit
the file

    /Users/name/Library/Jupyter/kernels/sagemath/kernel.json

To have a Jupyter kernel for each SageMath version,
you can rename or duplicate the folder and create:

    /Users/name/Library/Jupyter/kernels/sagemath-8.9
    /Users/name/Library/Jupyter/kernels/sagemath-9.0

and edit the `kernel.json` files in there.

These `kernel.json` files might look something like:

```
{
    "argv":
        [
            "/path/to/sagemath/local/bin/sage",
            "--python",
            "-m",
            "sage.repl.ipython_kernel",
            "-f", "{connection_file}"
        ],
    "display_name": "SageMath 9.0",
    "language": "sage"
}
```

So fixing it is just a matter of changing the path
in the first item of the "argv" list.

Make sure to use different "display_name" values
for the different kernels you install there.
Initially they will say

    "display_name": "SageMath",

so maybe use

    "display_name": "SageMath-8.9",

and

    "display_name": "SageMath-9.0",

to make them different.

If you would prefer to copy Sage's actual Jupyter kernel
than making up your own, you can locate it in the Sage
tree as follows.

Change to your Sage folder (repeat for each version of Sage,
replacing `/path/to/sagemath` with the actual folder for it):

    $ cd /path/to/sagemath
    $ find . -name "kernel.json"

This will give you a result like:

    ./local/share/jupyter/kernels/python3/kernel.json
    ./local/share/jupyter/kernels/sagemath/kernel.json

You can then copy `./local/share/jupyter/kernels/sagemath`
to say `/Users/name/Library/Jupyter/kernels/sagemath-x.y` --
use the folder revealed by `sage --jupyter kernelspec list`
and rename to `sagemath-9.0` or `sagemath-8.9` as you wish.

Hope this helps.  Kind regards,  --Samuel

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/046d7b9e-7118-4c5f-bae0-6f71c5589b26%40googlegroups.com.

Reply via email to