Sage Installation & Use

A place to learn how to install and use Sage on your personal computer.

This page is dedicated to helping students install and use SageMath on their personal computers. Sage is a powerful, free, open-source alternative to computer algebra and visualization systems like Mathematica, Maple, and Matlab. Based on the python programming language, it has a syntax that will be familiar to folks with some python programming background. However, python background is not required. Most of the major generative AIs, chatgpt, gemini, copilot, are quite adept at generating sage commands from your natural language prompts that you can paste into a sage cell and execute to get what you want.

You can try Sage without installing it on your personal computer using the cocalc.com platform. However, that platform is pretty aggressive about getting you to pay a subscription for a better use experience. To empower students and mathematicians, this page provides detailed steps to setup and use SageMath on their own computers.

Installation

The main place to learn about installing SageMath is the Sage Installation Guide.

macOS

The Sage Installation Guide is pretty effective and straightforward for learning how to install Sage on your Apple mac laptop. About the only thing to note is that in these instructions, you are asked: Do you want to do SageMath development? Overwhelmingly, the answer to this question is No. As a result, overwhemingly people should follow the 2nd section: No Development. The rest is pretty straightforward for mac users that have ever downloaded and installed a piece of software on their computer.

Windows

The Sage Installation Guide is ok for learning how to install Sage on your Windows computer. However, it is quite complicated and this guide attempts to fill in some of the gaps in the installation guide.

WSL

The first thing to note is that in these instructions, you are asked: Do you want to do SageMath development? Overwhelmingly, the answer to this question is No. As a result, overwhemingly people should follow the 2nd section: No Development.

Note: Sage relies on the existence of the Windows Subsystem for Linux (WSL) on your computer. As a result, you’re going to need about 40Gb of free space on your computer to install Sage.

Follow the Sage Installation Guide through to the grey box showing you how to activate and run sage. It’s at this point that things get challenging. You have run sage and now you’re looking at

┌────────────────────────────────────────────────────────────────────┐
 SageMath version 10.4, Release Date: 2024-07-19                    
 Using Python 3.11.11. Type "help()" for help.                      
└────────────────────────────────────────────────────────────────────┘
sage:

This is the default interface for sage and it is not very user friendly. Again, the overwhelming majority of Sage users will not work with sage this way. To get out of this type exit at the sage: prompt.

Fortunately, Sage provides a graphical option and you can read about that in the Launching SageMath instructions. Unfortunately, these instructions need a bit of clarification and in some cases are just wrong.

Jupyter Interface

Sage cleverly takes advantage of your web browser to construct its user interface. It uses a general, browser-based framework called Jupyter to accomplish this. The Launching SageMath shows, albeit incompletely, how to use Sage in jupyter.

Assuming that you’ve installed Sage following the instructions above, run the following commands at the WSL Ubuntu prompt:

$ conda activate sage
$ sage -n jupyter

The result will be a flood of text on the screen