FS#70150 - Offline MathJax rendering broken - falls back to cloudflare instead

Attached to Project: Community Packages
Opened by Chris (chwrtlprmft) - Wednesday, 24 March 2021, 17:16 GMT
Last edited by Antonio Rojas (arojas) - Thursday, 25 March 2021, 13:12 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Antonio Rojas (arojas)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



MathJax rendering for LaTeX does not work offline because instead of using the local MathJax installation (installed as a dependency of jupyterlab), the rendering is done remotely by a fallback to cloudflare. I have reported this issue upstream at jupyterlab (https://github.com/jupyterlab/jupyterlab/issues/9911) but it only occurs using this package, not when installing upstream jupyterlab via pip.

Additional info:
* package version(s) jupyterlab-3.0.12-1-any python-jupyter_packaging-0.7.12-1 (ref.  FS#70142 )
* https://github.com/jupyterlab/jupyterlab/issues/9911

Steps to reproduce:

Install package
$ sudo pacman -Syu --noconfirm
$ sudo pacman -S --noconfirm jupyterlab

Run jupyterlab
$ jupyter lab

In a Python notebook, request latex output by evaluating the following cell, while being offline (or blocking the cloudflare request):
This task depends upon

Closed by  Antonio Rojas (arojas)
Thursday, 25 March 2021, 13:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  jupyter-server-mathjax 0.2.0
Comment by Antonio Rojas (arojas) - Wednesday, 24 March 2021, 17:36 GMT
Works fine here. Please post the console output of the jupyterlab server.
Comment by Chris (chwrtlprmft) - Thursday, 25 March 2021, 06:56 GMT
Be sure to try offline or block cloudflare manually, and also make sure to clear your browser cache before, so that it does not have the cloudflare response cached.

Here's the output and attached a screenshot showing the couldflare requests.

$ singularity run jupyter-arch.sif
/usr/lib/python3.9/site-packages/jupyter_server/transutils.py:13: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
warnings.warn(warn_msg, FutureWarning)
[I 2021-03-25 08:11:51.049 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-03-25 08:11:51.078 LabApp] JupyterLab extension loaded from /usr/lib/python3.9/site-packages/jupyterlab
[I 2021-03-25 08:11:51.078 LabApp] JupyterLab application directory is /usr/share/jupyter/lab
[I 2021-03-25 08:11:51.081 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-03-25 08:11:51.082 ServerApp] Serving notebooks from local directory: /home/me
[I 2021-03-25 08:11:51.082 ServerApp] Jupyter Server 1.5.1 is running at:
[I 2021-03-25 08:11:51.082 ServerApp] http://localhost:8888/lab?token=562ae4e9a88ae8ad49389bfe3c206b341b1436eb623de94a
[I 2021-03-25 08:11:51.082 ServerApp] or
[I 2021-03-25 08:11:51.082 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2021-03-25 08:11:51.094 ServerApp] No web browser found: could not locate runnable browser.
[C 2021-03-25 08:11:51.095 ServerApp]

To access the server, open this file in a browser:
Or copy and paste one of these URLs:
[I 2021-03-25 08:12:01.509 LabApp] Build is up to date
[I 2021-03-25 08:12:02.044 ServerApp] Kernel started: 207d0fd4-3de2-452f-9344-0e7df7c98b17
[I 2021-03-25 08:12:12.234 ServerApp] Starting buffering for 207d0fd4-3de2-452f-9344-0e7df7c98b17:1fb40936-4cba-4f71-a311-8b97d6f29eae
Comment by Antonio Rojas (arojas) - Thursday, 25 March 2021, 10:09 GMT
Thanks, got it. Looks like I had a cached version.
Comment by Antonio Rojas (arojas) - Thursday, 25 March 2021, 11:27 GMT
I'm seeing the exact same behavior with a pip-installed jupyterlab
Comment by Antonio Rojas (arojas) - Thursday, 25 March 2021, 13:12 GMT
I've pushed jupyter-server-mathjax to the repos and added it as an optdepend for jupyter-server, as it seems to be required despite what upstream says.