Ask Your Question

jupyter (ipython notebook) kernel math display

asked 2015-10-20 20:25:38 -0500

oscarbranson gravatar image

I'm trying to set up sage as a jupyter (ipython notebook 4.0+) kernel on my local machine.

To do this, I have installed sage in /usr/local/sage, and set up a kernel using the SageKernelSpec tool (following instructions here).

My sage kernel.json looks like this:

{"display_name": "Sage 6.9", "argv": ["/usr/local/sage/sage", "-python", "-m", "sage.repl.ipython_kernel", "-f", "{connection_file}"]}

The kernel starts from within jupyter, and I am able to run sage. However, math text is not rendered. As an example:

x, y = var('x y')

> \newcommand{\Bold}[1]{\mathbf{#1}}\frac{x}{y}

The problem seems to be that the notebook is not recognising and formatting mathjax input properly. I have tried manually linking the sage mathjax library to ipython using:


But it still does not work.

I can get a properly functioning sage notebook by entering:

sage -n ipython

in terminal, but when starting the notebook from my standard jupyter environment (i.e. choosing the kernel from the dropdown list), the mathtype is not rendered.

I can't work out what's going on... any pointers appreciated.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-21 00:27:18 -0500

This looks similar to what was fixed in SageMath trac ticket 19374, which was merged in SageMath 6.9 (but not in any previous beta release, including SageMath 6.9.rc3).

Related issues were solved more recently at SageMath trac ticket 19373 and SageMath trac ticket 19371 and will likely be in the next beta release.

To follow beta releases, read the sage-release mailing list.

Issues are also discussed on sage-support and sage-devel, see for instance this thread on sage-support.

edit flag offensive delete link more


Thanks. If I understand you correctly, I should either get a beta release, or wait for the next release (I'm running 6.9 at the moment)?

I'm intrigued by the differences between the notebook started by 'sage -n ipython' and the sage kernel added to jupyter by SageKernelSpec... it seems like it should be possible to make the 'sage -n ipython' kernel the default, but I'm not familiar enough with the jupyter architecture to work out how to do this!

oscarbranson gravatar imageoscarbranson ( 2015-10-21 13:37:52 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2015-10-20 20:25:38 -0500

Seen: 1,947 times

Last updated: Oct 21 '15