3-manifolds / Sage_macOS

SageMath as a macOS application bundle.
156 stars 15 forks source link

MacOS Safari 14.1 disallows plugins (Java) so Tutorial and Jmol plot3D don't (seem to) work? #8

Closed enthor closed 3 years ago

enthor commented 3 years ago

(I am using the SageMath 9.3.rc4 binary and MacOS 11.4 (Big Sur) and Safari 14.1.1)

2.5.2 Three-Dimensional Plots mentions Jmol for plot3D, which is Java, apparently?

Executing the tutorial plot3d command produced a blank webpage. I did install Java but then discovered that plugins no longer work. Apple is demanding "web extensions" and HTML5, I think...

So, an issue re: documentation for installation requirements as well as the tutorial. Perhaps the workaround is to use Google Chrome? I am not planning to install Chrome just so that I can do the SageMath tutorial...

BTW, the help() command says that tutorial() and manual() are available, but

OSError: The document 'tutorial' does not exist.  Please build it
with 'sage -docbuild tutorial html --mathjax' and try again.

And

sage: -docbuild tutorial html --mathjax
File "", line 1 -docbuild tutorial html --mathjax ^ SyntaxError: invalid syntax

NathanDunfield commented 3 years ago

(I am using the SageMath 9.3.rc4 binary and MacOS 11.4 (Big Sur) and Safari 14.1.1)

2.5.2 Three-Dimensional Plots mentions Jmol for plot3D, which is Java, apparently?

Sage offers several backends for 3D plots. The current default is Jsmol (which uses JavaScript) not Jmol (which is Java) so definitely no need to install Java.

Are you trying this from the command line or via a Jupyter notebook? I'm guessing the command line as the tutorial examples work fine for me in a Jupyter notebook on Catalina with Safari 14.1. But the command-line version only works with Chrome. Does using the SageMath app to start a notebook allow you to run these tutorials?

NathanDunfield commented 3 years ago

This could be intermittent behavior, but it seems like even the command-line version works OK with Safari if and only if I turn on Safari's "Develop" menu from "Preferences...".

enthor commented 3 years ago

That information is helpful. I did set up Jupyter Notebooks yesterday and I will investigate. I will also investigate turning on the Develop menu. I plan to use both Command Line and Notebooks in the future, as well as from Python 3 code -- my plans are modest but evolving.

I very much appreciate the info, esp. wrt jsmol! Thank you for your time and energy.

If/when I have experimental results I will post them to confirm/question your solutions. Probably within 24 hours.

enthor commented 3 years ago

Ok, here is my report:

From SageTutorial, attempting

` 2.5.2 Three-Dimensional Plots Sage can also be used to create three-dimensional plots. In both the notebook and the REPL, these plots will be displayed by default using the open source package [Jmol], which supports interactively rotating and zooming the figure with the mouse. Use plot3d to graph a function of the form 𝑓 (𝑥, 𝑦) = 𝑧:

sage: x, y = var('x,y')
sage: plot3d(x^2 + y^2, (x,-2,2), (y,-2,2)) Graphics3d Object

`

Javascript=ON required for both command-line and Jupyter Notebook (notebook also requires Cookies=ON)

Safari "Develop" menu display = ON required for command-line; irrelevant for Jupyter Notebook

Internet=ON required for Jupyter Notebook (on first execution of cell), irrelevant for command-line.


My guess is that, aside from the Safari Develop menu item setting, the requirements above would likely hold true for Chrome and Firefox, and that these are not MacOS specific.

So this would be good information to provide in the Sage documentation. I understand that many if not most people habitually run with Javascript=ON and Cookies=ON, as well as Internet=ON. Because of the work from home and school from home during the past year, Comcast internet has been extremely unreliable no matter how much you pay them for non-business access. So internet is not guaranteed these days, which might cause problems for some users. I've had to purchase an additional data plan via Wireless (T-Mobile) for around $60 / month -- and run my phone as a Hotspot -- in order to be able to do my work continuously. Also, given the highly aggressive nature of internet advertising in 2021, running with cookies and javascript on results in popup ads and sub-optimal viewing experiences, so it is my preference to use these features only when absolutely necessary (to say nothing of the security risks of javascript.)

And, we could update the SageTutorial to reference jsmol instead of Jmol. Perhaps. I wonder how many Sage packages/features require javascript?

So, I am totally satisfied now. I am especially happy that the plot3d feature works -- that's a good one!!!

Thank you.

slel commented 3 years ago

The default 3D renderer in Sage is Three.js, not jsmol, I think.

Can you provide a link to the Sage tutorial you are referring to?

enthor commented 3 years ago

<<The default 3D renderer in Sage is Three.js, not jsmol, I think.

Can you provide a link to the Sage tutorial you are referring to?>>

https://doc.sagemath.org/html/en/tutorial/tour_plotting.html#three-dimensional-plots

"Sage can also be used to create three-dimensional plots. In both the notebook and the REPL, these plots will be displayed by default using the open source package [Jmol], which supports interactively rotating and zooming the figure with the mouse."


OK. Three.js? I will make a note of that. Thank you.