Differences between revisions 1 and 17 (spanning 16 versions)
Revision 1 as of 2017-10-05 10:38:28
Size: 447
Editor: embray
Comment: Initial stub for this page
Revision 17 as of 2024-03-04 00:22:08
Size: 3981
Editor: mkoeppe
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= SageMath Windows = = SageMath on Windows =
Line 3: Line 3:
As of SageMath 8.0 a native Windows binary installer is available for 64-bit versions of Windows 7 and up. The latest releases of the Windows installer can be found [[https://github.com/sagemath/sage-windows/releases|here]]. Most users will find this to be better-integrated with their native system than the old [[SageAppliance|VirtualBox appliance]]; however, the appliance is still available for those who prefer it. To run Sage on Windows, use Windows Subsystem for Linux as documented in the [[https://deploy-livedoc--sagemath.netlify.app/html/en/installation/index.html|Sage Installation Guide]].

==== Viewing 2D/3D plots from the WSL command line in a Windows browser ====

If you want to use your Windows browser to view 2D/3D plots produced from the Sage command-line in WSL, you will need to first create a small wrapper script to translate a WSL path into a Windows path and open it with the appropriate Windows app:

{{{#!highlight bash
#!/bin/bash
# wslview_wslpath.sh
wslview $(wslpath -w $1)
}}}

Make sure it is executable. Assuming you placed it in your home folder:

{{{#!highlight bash
chmod +x /home/<username>/wslview_wslpath.sh
}}}

Now, add the following to your [[https://doc.sagemath.org/html/en/reference/repl/startup.html#the-init-sage-script|init.sage]]:

{{{#!highlight python
# Open 2D/3D plots in Windows browser.
wslview_wslpath = '/home/<username>/wslview_wslpath.sh'
from sage.misc.viewer import viewer
viewer.browser(wslview_wslpath) # for 3D plots
viewer.png_viewer(wslview_wslpath) # for 2D plots

# Uncomment these lines to also open DVIs and PDFs in Windows.
#viewer.dvi_viewer(wslview_wslpath)
#viewer.pdf_viewer(wslview_wslpath)

# The Windows browser will be unable to access the threejs library installed
# in WSL, so you will need to use the online version of threejs.
sage.plot.plot3d.base.SHOW_DEFAULTS['online'] = True
}}}

==== Launching Jupyter/JupyterLab from WSL in the Windows browser ====

If you want to launch Jupyter/JupyterLab in your Windows browser, you will need to make a small config change. First, [[https://jupyter-notebook.readthedocs.io/en/stable/config.html|generate a config file]] if you haven't already done so using one of:

{{{#!highlight bash
sage --jupyter notebook --generate-config
sage --jupyter lab --generate-config
}}}

Then, open the config file and make sure the option `use_redirect_file` is set to `False`:

{{{#!highlight python
c.NotebookApp.use_redirect_file = False
}}}

=== CoCalc ===

[[https://cocalc.com/|CoCalc]] (formerly SageMathCloud) is a collaborative cloud-based computing environment, originally designed for using Sage in the cloud. Through CoCalc you can run Sage either in its command-line interface, or in a Jupyter Notebook, all through your web browser on a cloud-hosted environment, meaning you don't have to install any software (other than a web browser), but that you also need an internet connection.

CoCalc was originally designed by William Stein, the creator of Sage, to run Sage in the cloud (back when it was called SageMathCloud), but it was quickly realized that all the infrastructure needed to run Sage on the cloud can also be used for a more generic scientific computing environment, which the re-branded CoCalc now provides. You can see some of the software provided by a CoCalc environment [[https://cocalc.com/doc/software.html|here]].

You can create an unlimited account for free, though the free accounts are limited in the amount of disk space they provide, and the amount of RAM they provide. They also do not allow direct internet access from within the CoCalc environment (but you are allowed to upload your data files through the CoCalc interface). See https://cocalc.com/policies/pricing.html for more details. Sometimes William will also provide discounts for specific academic purposes, or for people who are willing to contribute to CoCalc's [[https://github.com/sagemathinc/cocalc|development]], though we cannot speak for him here.

As long as you have reasonably reliable internet connection, CoCalc is a great way to just try out Sage, and other open-source mathematics software, without having to go to the trouble of installing anything on your local machine. However, with a flaky or overloaded internet connection, it can sometimes be slow and frustrating.

SageMath on Windows

To run Sage on Windows, use Windows Subsystem for Linux as documented in the Sage Installation Guide.

Viewing 2D/3D plots from the WSL command line in a Windows browser

If you want to use your Windows browser to view 2D/3D plots produced from the Sage command-line in WSL, you will need to first create a small wrapper script to translate a WSL path into a Windows path and open it with the appropriate Windows app:

   1 #!/bin/bash
   2 # wslview_wslpath.sh
   3 wslview $(wslpath -w $1)

Make sure it is executable. Assuming you placed it in your home folder:

   1 chmod +x /home/<username>/wslview_wslpath.sh

Now, add the following to your init.sage:

   1 # Open 2D/3D plots in Windows browser.
   2 wslview_wslpath = '/home/<username>/wslview_wslpath.sh'
   3 from sage.misc.viewer import viewer
   4 viewer.browser(wslview_wslpath)    # for 3D plots
   5 viewer.png_viewer(wslview_wslpath) # for 2D plots
   6 
   7 # Uncomment these lines to also open DVIs and PDFs in Windows.
   8 #viewer.dvi_viewer(wslview_wslpath)
   9 #viewer.pdf_viewer(wslview_wslpath)
  10 
  11 # The Windows browser will be unable to access the threejs library installed
  12 # in WSL, so you will need to use the online version of threejs.
  13 sage.plot.plot3d.base.SHOW_DEFAULTS['online'] = True    

Launching Jupyter/JupyterLab from WSL in the Windows browser

If you want to launch Jupyter/JupyterLab in your Windows browser, you will need to make a small config change. First, generate a config file if you haven't already done so using one of:

   1 sage --jupyter notebook --generate-config
   2 sage --jupyter lab --generate-config

Then, open the config file and make sure the option use_redirect_file is set to False:

   1 c.NotebookApp.use_redirect_file = False

CoCalc

CoCalc (formerly SageMathCloud) is a collaborative cloud-based computing environment, originally designed for using Sage in the cloud. Through CoCalc you can run Sage either in its command-line interface, or in a Jupyter Notebook, all through your web browser on a cloud-hosted environment, meaning you don't have to install any software (other than a web browser), but that you also need an internet connection.

CoCalc was originally designed by William Stein, the creator of Sage, to run Sage in the cloud (back when it was called SageMathCloud), but it was quickly realized that all the infrastructure needed to run Sage on the cloud can also be used for a more generic scientific computing environment, which the re-branded CoCalc now provides. You can see some of the software provided by a CoCalc environment here.

You can create an unlimited account for free, though the free accounts are limited in the amount of disk space they provide, and the amount of RAM they provide. They also do not allow direct internet access from within the CoCalc environment (but you are allowed to upload your data files through the CoCalc interface). See https://cocalc.com/policies/pricing.html for more details. Sometimes William will also provide discounts for specific academic purposes, or for people who are willing to contribute to CoCalc's development, though we cannot speak for him here.

As long as you have reasonably reliable internet connection, CoCalc is a great way to just try out Sage, and other open-source mathematics software, without having to go to the trouble of installing anything on your local machine. However, with a flaky or overloaded internet connection, it can sometimes be slow and frustrating.

SageWindows (last edited 2024-03-04 00:22:08 by mkoeppe)