First time here? Check out the FAQ!

Ask Your Question
1

jupyter (ipython notebook) kernel math display

asked 9 years ago

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')
show(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:

use_local_mathjax()

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.

Thanks!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

slelievre gravatar image

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.

Preview: (hide)
link

Comments

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 ( 9 years ago )

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: 9 years ago

Seen: 3,334 times

Last updated: Oct 21 '15