Ask Your Question
1

Use of threejs and jmol in sage 9.1 for windows

asked 2020-10-12 13:35:15 +0100

Shaolinux gravatar image

updated 2020-10-12 14:51:58 +0100

slelievre gravatar image

I have been using SageMath 9.1 in Ubuntu 18.04 and the performance is excellent -- no questions asked.

Now I am trying to use SageMath 9.1 in a Msc level course, but the students' computers are all under Windows 10, and so on the classroom computer I have installed the latest 64 version of SageMath 9.1(with the 3 icons in the desktop, including the Jupyter NB which is the environment I always use). Using it, 3D scenes can only be seen as still images using "viewer='tachyon'". When using "viewer='jmol'" or "viewer='threejs'",there is no error message a scene is created, but it is empty -- blank space, no image. It seems that threejs and jmol are bundled in the repo for the Windows version of SageMath but for some reasons do not work.

In Windows 10 I have anaconda3 installed with Python 3 environment and Jupyter NB. Using it, I have tried to install Sagemath 9.1 from conda-forge using 'conda' (insluding conda-forge as a channel, with and without 'mamba' -- according to the respective instructions in the Sage manual for installing sage from anaconda) and this worked well in Ubuntu but not in Windows 10 -- in the latter case I get error message on the anaconda prompt: Encountered problems while solving. Problem: nothing provides requested sage

I have now also installed node.js and npm and, via the latter, also three.js . However, the installed SageMath does not recognize this version, and I do not know how to import it in the installed SageMath 9.1.

As a last measure, I have also installed the latest 64 version of Java and the latest 64 version of jmol (to be used via double-click on jmol.jar in the decompressed jmol bundle). The problem is similar as with threejs: the SageMath 9.1 does not recognize the installed jmol, and I do not know how to make it do so.

This is the situation. Can you help resolve this? I need to be able to use at least one of threejs and/or jmol (preferably, threejs!!) as alternative to tachyon in visualizing 3D scenes. Otherwise, I will have to radically restructure the course without using SageMath, since using Linux instead of Windows is, unfortunately, not an option.

edit retag flag offensive close merge delete

Comments

Hopefully someone will know of a solution. I don't.

Sage is available via Conda but only on Linux and macOS, not on Windows so far.

If you attempt to fix the problem by installing extra software, do that in the Cygwin in which Sage runs.

Otherwise it's very unlikely to solve anything.

Other options I can see are merely workarounds, but might allow you to run your course:

  • using Binder
  • using CoCalc
  • using SageCell
  • using JupyterHub
  • using Docker containers
slelievre gravatar imageslelievre ( 2020-10-12 15:06:26 +0100 )edit
2
Iguananaut gravatar imageIguananaut ( 2020-10-12 16:06:18 +0100 )edit
1

First of all, thanks to slelievre for the serious response and the recommendations which are clearly in correct positive direction. As slelievre notes, these are workarounds, so I decided to continue the search of a more direct and comprehensive solution before eventually resorting to following slelievre's recommendations. Second, SPECIAL THANKS to iguananaut for the second comment above. There is indeed connection between the present question and the question iguananaut refers to in the comment above. The two questions have a key non-void intersection, although they do not fully overlap. More important is that the solution proposed there is one of the three key points in the solution/answer of the present problem/question. I will now post my suggested solution in the answer section.

Shaolinux gravatar imageShaolinux ( 2020-10-13 04:12:57 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-10-13 06:33:49 +0100

Shaolinux gravatar image

updated 2020-10-14 19:52:04 +0100

slelievre gravatar image

I proposed the following solution some time ago, and now figured out a simplification of this solution, which I post separately in my remark to this solution -- see below. The users who are interested only in the practical solution of making jmol and threejs work under Windows 10, should skip the rest of the text here and read only my remark following this text. Users who are interested to know more about the reasons why jmol and threejs do not work under the default settings of Windows 10 can read the remaining part of this text, and then treat my remark below only as a shortcut of the solution given here.

See first my remark to the remarks of Slelievre and Iguananaut above. I will need to explain the parts of the solution in order reverse to the order in which they were discovered. The last and most important observation is that Iguananaut is right and both jmol and threejs work (used in the way described in the question) if the Jupyter NB is opened in Chrome. The second observation is that the default settings in Windows 10 make it impossible for Jupyter NB to open in Chrome, that is, administrative rights are needed to disable some components off. The third observation is that as soon as these changes are made, the operating system forbids the automatic access to the Jupyter NB config file. From this moment on, the problem about launching Jupyter NB js solved in the same way for SageMath and for Anaconda (and the solution (for the case of Anaconda) can be found in the Internet): the Jupyter NB config file is opened in, say, Notepad, and it is found to contain a certain link which, when pasted into Chrome, launches Jupyter NB with full functionality of jmol and almost full functionality of threejs (some of the spatial, opacity, etc. controls of three.js are missing, but the effect of this is minor).

The steps of the solution in order of their execution:

  1. Uninstall SageMath (if there is a previous installation, even if it is of the latest version - currently Sage 9.1);
  2. Open MS start menu; 2-click on Settings at the leftmost vertical menu;
  3. 2-Click on Apps.
  4. Upper-right, 2-click on 'Programs and Features';
  5. Upper-left, 2-click on 'Turn Windows features on or off'
  6. Provide administrative name and password
  7. In the appearing menu, turn OFF: 1. Internet Explorer 11 and 2. Microsoft Print to PDF (otherwise this one converts Chrome pages to PDF version in which Jupyter NB is accessible but both jmol and threejs are not working), 3. Media Features (I am not sure about item 3 but turned it off, anyway). If something does not work at the end of the algorithm, you should return to step 7 and consider turning more features off, until success (working jmol and threejs in Jupyter NB) is achieved.
  8. Uninstall any browser other than Chrome and Microsoft Edge. (In my case, I uninstalled Firefox. Without doing this, after the execution of step 7 above, and despite the fact that Chrome was selected as the primary browser in the operating system, in the newly installed Sage 9.1 (see step 9 below) Jupyter NB opened in Firefox, and not in Chrome (!!!).) Microsoft Edge proved to be irrelevant in this context. 9 Reinstall (full installation) Sage 9.1. At the end of the installation, Jupyter NB DOES NOT OPEN -- IN CHROME OR ANYWHERE. Information from the terminal indicates that the reason for this is that at this point the operating system (i.e., Windows 10) forbids automatic access to the config file of Jupyter NB (the exact path to, and name of, the file is given in the terminal message). (These were a lot of 'this' and 'that'! :) )
  9. Open the said config file, say, in Notepad, and copy the full internet address given there.
  10. Paste the full internet address from step 10 into a new Chrome webpage: the Jupyter NB is launched; open a new Sage 9.1 notebook and verify on an appropriate 3d example that the viewers jmol and threejs work properly, alongside tachyon.

I believe that after this, one can reinstall Firefox and other browsers as secondary browsers, but I have not done this myself, so the correctness of this claim has not been tested yet.

Iguananaut, for your valuable input you deserve to be raised to rank Godzillanaut! :) Thanks once again.

edit flag offensive delete link more

Comments

1

The promised shortcut:

  1. Install Chrome and Sage 9.1 (full installation, with the 3 icons).
  2. 2-click on the Jupyter NB icon. Terminal window appears and at the end MS PDF-converted page of Jupyter NB appears.
  3. Erase the webpage; keep the terminal window with the full history of the Jupyter NB launching.
  4. Open a new Chrome webpage.
  5. In the terminal window, copy the specified localhost full address (including the token).
  6. Paste this address into the Chrome webpage and navigate to it. The Jupyter NB webpage REAPPEARS. In it, select a new Sage 9.1 environment and verify that NOW BOTH JMOL AND THREEJS WORK!

The same procedure works for the use of jmol and threejs in JupyterNB in environments other than SageMath in Anaconda in Windows 10.

Shaolinux gravatar imageShaolinux ( 2020-10-14 20:08:00 +0100 )edit

Well done, please mark your answer as accepted, so the question will appear as solved.

slelievre gravatar imageslelievre ( 2020-10-14 23:05:07 +0100 )edit

Tried, but did not have enough points to accept it. By the way, Shao-Linux is my earlier account -- maybe you wish to unite them under the new name Shaolinux?

Shaolinux gravatar imageShaolinux ( 2020-10-15 08:39:43 +0100 )edit

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: 2020-10-12 13:35:15 +0100

Seen: 490 times

Last updated: Oct 14 '20