Ipython notebook : mathjax availability depends on the way one starts sage...

129 views
Skip to first unread message

Emmanuel Charpentier

unread,
Oct 22, 2015, 8:57:54 AM10/22/15
to sage-support
Despite 19371, I still have problems getting mathjax to work in the Ipython notebook :

Starting from a working directory, to work on a local sheet :

charpent@SAP5057241:~/Boulot/DiversRatiche/Abdelaziz$ sage -n ipython
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10.beta0, Release Date: 2015-10-15              │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Please wait while the Sage Notebook server starts...
[I 14:43:26.353 NotebookApp] Using MathJax: ../nbextensions/mathjax/MathJax.js
[W 14:43:26.393 NotebookApp] Terminals not available (error was No module named terminado)
[I 14:43:26.394 NotebookApp] Serving notebooks from local directory: /home/charpent/Boulot/DiversRatiche/Abdelaziz
[I 14:43:26.394 NotebookApp] 0 active kernels
[I 14:43:26.394 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 14:43:26.394 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

(process:27610): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed

Here I start a local sheet :

[W 14:43:29.939 NotebookApp] Notebook Mod1.ipynb is not trusted
[I 14:43:30.300 NotebookApp] Kernel started: ccfa2cd2-604b-452b-901a-18fc550c444a
[I 14:43:49.870 NotebookApp] Kernel restarted: ccfa2cd2-604b-452b-901a-18fc550c444a

Mathjax works OK in the local sheet

[I 14:44:15.435 NotebookApp] Saving file at /Mod1.ipynb
[I 14:44:18.950 NotebookApp] Kernel shutdown: ccfa2cd2-604b-452b-901a-18fc550c444a
^C[I 14:44:25.114 NotebookApp] interrupted
Serving notebooks from local directory: /home/charpent/Boulot/DiversRatiche/Abdelaziz
0 active kernels
The IPython Notebook is running at: http://localhost:8888/
Shutdown this notebook server (y/[n])? y
[C 14:44:27.625 NotebookApp] Shutdown confirmed
[I 14:44:27.626 NotebookApp] Shutting down kernels
charpent@SAP5057241:~/Boulot/DiversRatiche/Abdelaziz$


Now, starting from my home directory :

charpent@SAP5057241:~/Boulot/DiversRatiche/Abdelaziz$ cd
charpent@SAP5057241:~$ sage -n ipython
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10.beta0, Release Date: 2015-10-15              │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Please wait while the Sage Notebook server starts...
[I 14:44:33.318 NotebookApp] Using MathJax: ../nbextensions/mathjax/MathJax.js
[W 14:44:33.364 NotebookApp] Terminals not available (error was No module named terminado)
[I 14:44:33.365 NotebookApp] Serving notebooks from local directory: /home/charpent
[I 14:44:33.365 NotebookApp] 0 active kernels
[I 14:44:33.365 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 14:44:33.365 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

(process:27723): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
[W 14:44:33.965 NotebookApp] /home/charpent/U: doesn't exist
[W 14:44:33.966 NotebookApp] /home/charpent/G: doesn't exist
[W 14:44:33.968 NotebookApp] /home/charpent/L: doesn't exist
[W 14:44:33.971 NotebookApp] /home/charpent/fauchard-sshfs-lien doesn't exist
[W 14:44:33.978 NotebookApp] /home/charpent/G doesn't exist
[W 14:44:33.990 NotebookApp] /home/charpent/alpha-sshfs-lien doesn't exist
[W 14:44:33.993 NotebookApp] /home/charpent/O: doesn't exist
[W 14:44:33.997 NotebookApp] /home/charpent/K: doesn't exist
[W 14:44:34.001 NotebookApp] /home/charpent/alpha-dav-lien doesn't exist

Here I get a dialog box telling me that mathjax is unavailable.

[W 14:44:48.352 NotebookApp] 404 GET /notebooks/Boulot/DiversRatiche/nbextensions/mathjax/MathJax.js?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured (127.0.0.1): No such file or directory: Boulot/DiversRatiche/nbextensions/mathjax/MathJax.js
[W 14:44:48.361 NotebookApp] 404 GET /notebooks/Boulot/DiversRatiche/nbextensions/mathjax/MathJax.js?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured (127.0.0.1) 9.10ms referer=http://localhost:8888/notebooks/Boulot/DiversRatiche/Abdelaziz/Mod1.ipynb
[I 14:44:49.319 NotebookApp] Kernel started: 32ffd7e9-72d9-46ed-8c4a-76d197f67e3a
[I 14:44:59.898 NotebookApp] Kernel shutdown: 32ffd7e9-72d9-46ed-8c4a-76d197f67e3a
^C[I 14:45:10.810 NotebookApp] interrupted
Serving notebooks from local directory: /home/charpent
0 active kernels
The IPython Notebook is running at: http://localhost:8888/
Shutdown this notebook server (y/[n])? y
[C 14:45:13.489 NotebookApp] Shutdown confirmed
[I 14:45:13.490 NotebookApp] Shutting down kernels
charpent@SAP5057241:~$


It seems clear that something is flawed in Sage's version of the Ipython notebook : its extensions search path seems flawed.

Any ideas ?

HTH,

--
Emmanuel Charpentier

Jeroen Demeyer

unread,
Oct 22, 2015, 12:31:30 PM10/22/15
to sage-s...@googlegroups.com
On 2015-10-22 14:57, Emmanuel Charpentier wrote:
> │ SageMath Version 6.10.beta0, Release Date: 2015-10-15 │

This version doesn't have the latest Jupyter fixes, please try again
with Sage 6.10.beta1.

Emmanuel Charpentier

unread,
Oct 23, 2015, 1:26:57 AM10/23/15
to sage-support

Same result, alas...

HTH,

--
Emmanuel Charpentier

Jeroen Demeyer

unread,
Oct 23, 2015, 2:19:57 AM10/23/15
to sage-s...@googlegroups.com
On 2015-10-23 07:26, Emmanuel Charpentier wrote:
> Same result, alas...

Works for me, there must be something wrong with your configuration.

Emmanuel Charpentier

unread,
Oct 23, 2015, 4:43:10 AM10/23/15
to sage-support
One more data point : I installed the sagemath kernel in a system-wide Jupyter notebook by symlinking /usr/local/sage/local/share/jupyter/kernels/sagemath into /usr/local/share/jupyter/kernels/ (that's where a systemwide installation of the IRkernel in the systemwide installation of Jupyter (on Deban) ended up installing the relevant files) and *not* using /usr/local/sage/local/etc/jupyter/jupyter_notebook_config.py (didn't know what to do with it...), and the resulting installation worked as expected.

The content of jupyter_notebook_config.py sounds fishy to me :

# Configuration file for Sage's builtin Jupyter notebook server

# Note for distributors: Sage uses mathjax, so the notebook server
# needs to have the mathjax_url set to wherever your distribution
# installs mathjax.

c.NotebookApp.mathjax_url = '../nbextensions/mathjax/MathJax.js'


I fail to understand how this relative path is used...

HTH,

--
Emmanuel Charpentier

Emmanuel Charpentier

unread,
Oct 23, 2015, 4:52:36 AM10/23/15
to sage-support
Wups : I forgot to tell that I also symlinked /usr/local/sage/local/share/jupyter/nbextensions/* into /usr/local/share/jupyter/nbextensions (hand-created).

HTH,

--
Emmanuel Charpentier

Jeroen Demeyer

unread,
Oct 23, 2015, 7:48:59 AM10/23/15
to sage-s...@googlegroups.com
Now I am *totally* confused. Can you please just reboot this thread,
i.e. pretend that I haven't read anything of this thread and explain
from scratch what your setup is and what your problem is.

Emmanuel Charpentier

unread,
Oct 23, 2015, 12:19:00 PM10/23/15
to sage-support

Okay.

I have a Sagemath (currently 6.10beta1) installation in /usr/local/sage. For the record, /usr/local/bin/sage is symlinked to /usr/local/sage/sage.

I tried two things :

1) using Sagemath's version of the IPython notebook (lainched with "sage -n ipython" or "sage -n jupyter") : it turns out that the resulting notebook
- *does* have access to mathjax when working on sheets stored in the directory where the command has been given (the sheet opens and displays math correctly) ;
- does *not* have access to mathjax when one navigates in the notebook to a different directory in order to work on sheets stored in that directory :
    + an error dialog box appears telling mathjax is inaccessible ;
    + the *relative* path to matjax is in the title of the dialog box ;
    + the typeset output does not appear (nothing appears in the cells where a typeset result is expected).

2) I also tried to install the Sagemath kernel in a systemwide installation of Ijupyter(obtained by "pi³ install jupyter"). This installation has been previously tested by installing the IRKernel interface to a systemwide R. As suggested by William, I symlinked $SAGE_LOCAL/share/jupyter/kernels/* and $SAGE_LOCAL/share/jupyter/nbextensions/* to the corresponding subdirectories of /usr/local/share/jupyter/ (Debian's idea of the systemwide configuration of Jupyter).
This gave me a notebook interface where I could operate on Python, Sagemath and R sheets ; the Sage sheets could use mathjax wherever they were launched.

I hope to have been clearer...

HTH,

--
Emmanuel Charpentier

Thierry Dumont

unread,
Oct 23, 2015, 1:21:09 PM10/23/15
to sage-s...@googlegroups.com
This seems related to the problem I had when running sage under jupyter
hub, and also in jupyter (the later: launching jupyter, then sage
6.0beta1):
-some parts of the documentation (the documentation in the sage tree)
cannot be accessed (FAQs for example).

But now (since 6.0beta1?), jsmol is ok, and for me mathjax too.

This all looks like a symlink problem...
> --
> 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...@googlegroups.com
> <mailto:sage-support...@googlegroups.com>.
> To post to this group, send email to sage-s...@googlegroups.com
> <mailto:sage-s...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

tdumont.vcf

Jeroen Demeyer

unread,
Oct 23, 2015, 2:18:31 PM10/23/15
to sage-s...@googlegroups.com
On 2015-10-23 18:19, Emmanuel Charpentier wrote:
> I have a Sagemath (currently 6.10beta1) installation in /usr/local/sage.
Just to be clear from the start: you did run "make", right?

Emmanuel Charpentier

unread,
Oct 23, 2015, 3:22:36 PM10/23/15
to sage-support

How do you think I built Sage ? To be precise, I typed "time ( make doc-clean && make )" since a) I wanted a timing and b) make sometimes (often ?) fails building the documentation when it has not a "clean slate".

I'll redo that just to check... Stay tuned (about ~40 minutes  with MAKE="make -j8").

HTH,

--
Emmanuel Charpentier

Emmanuel Charpentier

unread,
Oct 23, 2015, 3:36:48 PM10/23/15
to sage-support
It was faster than that since it had "just" to rebuild the docs...

Same result : I started the Sage notebook ("sage -n jupyter")in my $HOME, navigated to a subdirectory and tried to create a notebook. Seen in the console :

[I 21:30:20.363 NotebookApp] Creating new notebook in /Boulot/Bayes/BayesVsFreq
[W 21:30:20.759 NotebookApp] 404 GET /notebooks/Boulot/Bayes/nbextensions/mathjax/MathJax.js?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured (::1): No such file or directory: Boulot/Bayes/nbextensions/mathjax/MathJax.js
[W 21:30:20.764 NotebookApp] 404 GET /notebooks/Boulot/Bayes/nbextensions/mathjax/MathJax.js?config=TeX-AMS_HTML-full,Safe&delayStartupUntil=configured (::1) 4.87ms referer=http://localhost:8888/notebooks/Boulot/Bayes/BayesVsFreq/Untitled.ipynb?kernel_name=sagemath
[I 21:30:21.243 NotebookApp] Kernel started: 0af7fea8-2172-4a6e-9559-7d544f263fcc
[I 21:30:42.100 NotebookApp] Kernel shutdown: 0af7fea8-2172-4a6e-9559-7d544f263fcc

and, yes, I got the same infamous error dialog box.

Now, I don't understand why I DON'T get this error when working on a sheet in the start directory...

HTH,

--
Emmanuel Charpentier

Jeroen Demeyer

unread,
Oct 23, 2015, 3:37:36 PM10/23/15
to sage-s...@googlegroups.com
On 2015-10-23 21:22, Emmanuel Charpentier wrote:
> Le vendredi 23 octobre 2015 20:18:31 UTC+2, Jeroen Demeyer a écrit :
>
> On 2015-10-23 18:19, Emmanuel Charpentier wrote:
> > I have a Sagemath (currently 6.10beta1) installation in
> /usr/local/sage.
> Just to be clear from the start: you did run "make", right?
>
>
> How do you think I built Sage ?

Well, obviously you did run "make" at *some* point. The question was
really: did you run "make" since upgrading to Sage 6.10.beta1?

Emmanuel Charpentier

unread,
Oct 23, 2015, 3:43:52 PM10/23/15
to sage-support
I just re-( make doc-clean && make )'d for the rest of our souls.

With the same results...

HTH,

--
Emmanuel Charpentier

Volker Braun

unread,
Oct 24, 2015, 7:12:18 AM10/24/15
to sage-support
I've extracted a bug report at http://trac.sagemath.org/ticket/19469

Emmanuel Charpentier

unread,
Oct 24, 2015, 10:07:01 AM10/24/15
to sage-support
Thanks a lot, Volker ! Your abstract of the problem is much better than what I was planning...

I Cc'd myself on the ticket.

--
Emmanuel Charpentier
Reply all
Reply to author
Forward
0 new messages