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)