Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No latex display in the notebook when offline #36914

Open
2 tasks done
egourgoulhon opened this issue Dec 18, 2023 · 28 comments
Open
2 tasks done

No latex display in the notebook when offline #36914

egourgoulhon opened this issue Dec 18, 2023 · 28 comments

Comments

@egourgoulhon
Copy link
Member

Steps To Reproduce

With Sage 10.3.beta2 running on a computer that is offline (not connected to internet), open a new Jupyter notebook with sage -n and type the following code:

%display latex
sin(x^2)

Expected Behavior

The output should be a typeset formula.

Actual Behavior

The output is raw latex:

\(\displaystyle \sin\left(x^{2}\right)\)

Additional Information

There is no such issue with Sage 10.2. It is most likely due to the Notebook upgrade performed in #36129

Environment

- **OS**: Ubuntu 22.04
- **Sage Version**: 10.3.beta2

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@egourgoulhon
Copy link
Member Author

A data point: with Sage 10.2, the offline latex display works with jupyterlab (sage -n jupyterlab) as well, while with Sage 10.3.beta6, it works neither with jupyter (now emulated by jupyterlab) nor jupyterlab.

@mkoeppe, @kwankyu do you have any idea or suggestion?

@kwankyu
Copy link
Collaborator

kwankyu commented Feb 2, 2024

I cannot reproduce this with 10.3.beta6 on mac. Is it only on Ubuntu?

@egourgoulhon
Copy link
Member Author

I cannot reproduce this with 10.3.beta6 on mac.

Thanks for the feedback.

Is it only on Ubuntu?

I cannot say. I've tested it on 2 computers both running Ubuntu 22.04. I'll send a query for further tests on sage-devel.

@egourgoulhon
Copy link
Member Author

egourgoulhon commented Feb 14, 2024

I'll send a query for further tests on sage-devel.

Here is the post:
https://groups.google.com/g/sage-devel/c/sSBryLVqQk4

@egourgoulhon
Copy link
Member Author

Another data point: there is no error message in the console from which sage -n was run when the computer is offline. Simply the MathJax display fails silently.

@egourgoulhon
Copy link
Member Author

egourgoulhon commented Feb 14, 2024

For reference, I copy here an extract of https://groups.google.com/g/sage-devel/c/sSBryLVqQk4/m/xepfECrvAQAJ

  • Sage 10.2 uses Ubuntu 22.04's MathJax (v2.7.9), so there is no issue when the computer is offline.
  • Sage 10.3.beta* refuses to use Ubuntu 22.04's MathJax and the MathJax 3.2.0 shipped with Sage is not used either

@egourgoulhon
Copy link
Member Author

For reference, the post on Jupyter forum:
https://discourse.jupyter.org/t/notebook-with-mathjax-without-internet-connection/23958

@kwankyu
Copy link
Collaborator

kwankyu commented Feb 26, 2024

"blocker" label is getting overloaded too much.

Let's use "blocker" only for PRs and use "critical" for issues.

@dimpase
Copy link
Member

dimpase commented Feb 26, 2024

I think this is due to sticking with MathJax-2 rather than moving to MathJax-3 (well, in the latter case you have non-wrapped, although scroll-able, long formlae).

Jupyterlab ships with a copy of MathJax-3, so installing mathjax2 overrides it (but breaks off-line working).

@mkoeppe
Copy link
Member

mkoeppe commented Mar 4, 2024

@mkoeppe mkoeppe added this to the sage-10.3 milestone Mar 4, 2024
@mkoeppe
Copy link
Member

mkoeppe commented Mar 4, 2024

Some relevant places in the code

@mkoeppe
Copy link
Member

mkoeppe commented Mar 5, 2024

I've added this to https://github.com/sagemath/sage/wiki/Sage-10.3-Release-Tour#known-problems-and-workarounds

Could someone please check whether this workaround works?

@kwankyu
Copy link
Collaborator

kwankyu commented Mar 6, 2024

I checked it works.

As expected, with ./sage -pip uninstall jupyterlab-mathjax2, mathjax3 returns and offline maths work, but also newline, as seen in a markdown cell with

$\sqrt{2} \\ \sqrt{3}$

does not work. Perhaps this should also be noted in the release tour.

@mkoeppe
Copy link
Member

mkoeppe commented Mar 6, 2024

Thanks a lot for checking.

@mkoeppe
Copy link
Member

mkoeppe commented Mar 6, 2024

In #37550, I restore our mathjax package from before the upgrade to 3 in #25833.
I don't know if it is suitable to work with jupyterlab-mathjax2 or how to configure it. Restoring the package is a possible starting point if someone wants to try this.

@dimpase
Copy link
Member

dimpase commented Mar 8, 2024

This should not be a "workaround", there should be user's choice what mathjax, or, moreover, what jupyter to use with Sage.

@kwankyu
Copy link
Collaborator

kwankyu commented Mar 8, 2024

A user already has choices. No one prevents users from using system jupyter. What do you mean?

@dimpase
Copy link
Member

dimpase commented Mar 8, 2024

I mean that we should not saddle the user with a particular Jupyter installation at all.
E.g. with Sage's macOS app it's not even used!

@mkoeppe mkoeppe removed this from the sage-10.3 milestone Mar 20, 2024
@mkoeppe mkoeppe added this to the sage-10.4 milestone May 3, 2024
@kh-abd-kh
Copy link

./sage -pip uninstall jupyterlab-mathjax2
solves the problem partialy but not completely.

Over Win11, WSL Ubuntu 22.04
If you use
~/sage-10.4.beta9/sage --notebook jupyterlab
and then someting like tutorial(), now for the first time, the help system works prefectly. (google-chrome)
-congrats- :)

But if you use
~/sage-10.4.beta9/sage --notebook jupyterlab --no-browser
and go open jupyter from inside Win11 edge NO LATEX appears in the help at all.

Just to be aware, for me I am happy to see the help is working.

@kwankyu
Copy link
Collaborator

kwankyu commented Jun 12, 2024

In

$ sage --notebook jupyterlab --no-browser
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.4.beta9, Release Date: 2024-06-09              │
│ Using Python 3.12.3. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Sage doc server started running at http://127.0.0.1:58147

http://127.0.0.1:58147 is the url to a local doc server running in WSL. Try to open the url. I am curious how it works (or not) in WSL.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2024

On which side the LaTeX fonts matter? on the remote side (WSL), or on the local (Windows).

Locally one can try different clients, e.g. VSCode has nice Jupyter support

@kh-abd-kh
Copy link

That what i used
~/sage-10.4.beta9/sage --notebook jupyterlab --no-browser
and then paste the localhost address.
(sudo make install didn't "link" sage)

On the Win11 side,
1- I am using Jupyter from Win11 as unified platform for different pythons.
OpenCL Ryzen 7 Renoir gpu only works from Win11 no WSL
2- CUDA sometimes faster from WSL but also Win11 can be faster. It depends.
for the time being sage has zero-support for these stuff even Numba Jit is broken in sage.
3- WSL had problems with gui apps. Connecting/Disconnecting the internet. Crashs google-chrome
and Jupyter so I was forced to use the Win side. It is almost fixed with the last update but still
i have RAM crashs. When you do some calculations that exceeds the RAM. Now, sometimes
kernel restart (the normal) but still sometimes the whole WSL crashs, now, less but still.
I feel it in Sage/Jupyter more than anything else actually i don't remember it happened out of Sage.
due to extinsive RAM calculations, not sage but may be jupyter.
Sage without Jupyter can make kernel(sage) crashs but not the whole WSL.


I have no latex installed in Win11, I use Scientific Workplace 5.5 for Latex Win11.
I am not using any MS for prog (VScode). sorry.


Sorry, this is a little summary of WSL problems as far as i have gone through.

Last Monday, for the first time in 5 years, i downloaded and compiled Sage without
any crashs.

@dimpase
Copy link
Member

dimpase commented Jun 12, 2024

Putting WSL aside for a while, do you get LaTeX in notebooks (say, just Python) running on your Windows Jupyter?
If not, that's where the problem is, I think.

@kh-abd-kh
Copy link

kh-abd-kh commented Jun 12, 2024

~/sage-10.4.beta9/sage --notebook jupyterlab --no-browser
then
from Win/Edge/Jupyter

%display latex
sin(x^2)

yes it works without problems

@kh-abd-kh
Copy link

wsl_latex

@dimpase
Copy link
Member

dimpase commented Jun 12, 2024

~/sage-10.4.beta9/sage --notebook jupyterlab --no-browser then from Win/Edge/Jupyter

%display latex sin(x^2)

yes it works without problems

So it does work, contrary to what you wrote above?

And what exactly does not work, if anything?

@kh-abd-kh
Copy link

The Help System


If you use
~/sage-10.4.beta9/sage --notebook jupyterlab
and then someting like tutorial(), now for the first time, the help system works prefectly. (google-chrome)
-congrats- :)

But if you use
~/sage-10.4.beta9/sage --notebook jupyterlab --no-browser
and go open jupyter from inside Win11 edge NO LATEX appears in the help at all.


Sorry for the confusion

@kh-abd-kh
Copy link

wsl_latex _ help

@mkoeppe mkoeppe removed this from the sage-10.4 milestone Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants