How to install Sagemath on Windows – Step By Step Guide

Installation of Sagemath on Windows is not as easy as other software but here in this article, we will make it easy by providing an illustrated image of each step.

Sagemath could not be operated directly on Windows, and to run it on Windows first we need to install a window sub-system for Linux and a Linux distribution which will be used to run Sagemath.

Installation of Wsl and Linux Distro

Wsl stands for Windows Subsystem for Linux, and Linux Distro is an operating system such as Ubuntu, Debian, Kali Linux, Fedora, etc. 

Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting “Run as administrator“.

Enter “wsl –install”, this command will automatically install Windows virtual machine platform, windows subsystem for Linux, and finally Ubuntu Linux distribution upon restarting the computer.

Enter “Restart Computer”, and this command will reboot your PC. After Rebooting Ubuntu will be automatically set up for you. Enter the Password and re-confirm the password. Now Linux and Linux distribution have been successfully installed on your PC.

Installing all Dependencies

Enter the command “sudo apt-get update”, this will update the latest list of packages. 

Building sage from source requires some packages, and those packages list is present on the Ubuntu Package Installations page. Copy only the first list, and paste it into the command prompt by just right-clicking.

The package installation process takes some time, and some of them require user permission which can be granted by typing “y”, and then pressing Enter.

Downloading and Installation of Sagemath

Download sage math from https://www.sagemath.org/download-source.html, select a suitable mirror, and download the file on your computer. 

Type “explorer.exe .”, this will open a directory of Linux on your system. Copy the downloaded source tarball sage-9.8.tar.gz, and paste the file into a new folder named Sage inside the user directory. 

Change the directory to Sage in the command prompt using the command “cd Sage”.

Untar the source tarball “sage-9.8.tar.gz” by typing the command “tar xf sage-x.y.tar.gz”. A new folder will be created named sage-9.8 inside the Sage folder.

Now we don’t need source tarball “sage-9.8.tar.gz”, and this file can be removed from Linux Subsystem using the command “rm sage-9.8.tar.gz”.

Run the command “./configure”, this will ensure whether all necessary dependencies are present or not before build. No need to install additional dependencies if it asks.

Now finally run the command “./make”, this command will build the Sagemath from the source, and it will take many hours depending upon the speed of your computer. 

Since this process takes many hours to complete and could be broken due to power loss or any other reason. The process can be resumed with the same command “./make”.

Launching Sage Math

Open the Ubuntu app, change the directory using “cd Sage/sage-9.8”, and then run “./sage”, this will launch the sage math in the command Line.

References 

Setup Wsl and Ubuntu Distro
How to create a script in bash shell or Linux shell 
Install Jupyter Notebook
Sage Math Installation
How to use power shell
Compile and Installing software from source code in Linux

Leave a comment