Ask Your Question

Revision history [back]

Here is a quick overview of how to compile Sage from source.

See also the official "install SageMath from source" guide.

  • install the necessary prerequisites

  • get the Sage source files

    • either using Git:

      $ git clone --single-branch --branch develop --tags https://github.com/sagemath/sage.git
      
    • or by downloading from the SageMath development release download page

      • using a web browser
      • or using curl or wget

      and extracting the downloaded archive

      • by double-clicking it
      • or in the terminal with

        $ tar xf sage-X.Y.betaZ.tar.gz
        
  • change to the directory obtained above

    $ cd sage  # or:  cd /path/to/extracted/directory/
    
  • in the terminal, run the following commands

    • select the develop branch and update it

      $ git checkout develop
      $ git pull origin develop --tags
      
    • check the current branch and what remote branch it is tracking

      $ git branch -vv
      
    • select the number of jobs to run in parallel

      $ MAKE='make -j1'  # or -j4 to build with 4 jobs in parallel, etc.
      
    • run the configuration script

      $ make configure
      $ ./configure
      

    Note that this will end with a suggestion of extra packages to install. Follow these instructions for Sage to use those system packages! Doing can make building Sage take a lot less time and energy.

    • finally, build Sage

      $ make -s V=0
      

Once all that is done

  • if the build fails, it will say what packages failed to build

  • if all goes well, the output will end with something like

    Testing that Sage starts...
    [2020-07-31 20:42:27] SageMath version 9.2.beta6, Release Date: 2020-07-25
    This looks like the first time you are running Sage.
    Cleaning up, do not interrupt this.
    Done cleaning.
    Yes, Sage starts.
    
    real    250m37.393s
    user    234m8.482s
    sys 20m59.096s
    Sage build/upgrade complete!
    

If all went well, optionally, run Sage tests with one of

$ make test
$ make testlong
$ make testall
$ make testalllong
$ make ptest
$ make ptestlong
$ make ptestall
$ make ptestalllong

(see the SageMath developer guide for the differences between those).

That will take some time! In the end,

  • files with failing doctests or timeouts will be listed

  • or the joyous "All tests passed!" will appear!

To provide regular reports of success or failure of building and testing on Raspberry Pi, ideally,

  • subscribe to the sage-release mailing list

  • post your reports as a reply to the release manager's announcement for the appropriate development release (currently SageMath 9.2.beta6).

    For instance, if your success or failure to build was with SageMath 9.2.beta6, reply to Volker Braun's post "Sage 9.2.beta6 released".