From Funtoo
Revision as of 05:56, March 21, 2017 by Tassietux (talk | contribs) (consistent heading levels)
Jump to navigation Jump to search

SageMath is mathematical software with features covering many aspects of mathematics, including algebra, combinatorics, numerical mathematics, number theory, and calculus.

Screenshot from SageMath


SageMath ebuilds are not present in the Funtoo portage tree. Instead these are available through separate overlays (repositories). To install SageMath on Funtoo Linux the overlay sage-on-gentoo is required, together with dependencies found in the overlay science.

Gentoo users will be familiar with the science overlay from Gentoo's Science Project (

Install Required Overlays

Using layman

The easiest (fastest) method of installing the required overlays is via the package layman (app-portage/layman). Make sure layman is installed with USE=git and correctly configured. You may find a guide for layman at:

Update your layman list:

root # layman -L

Add the two overlays to Funtoo. Firstly is the science overlay (if not already installed):

root # layman -a science

Finally, add the SageMath overlay:

root # layman -a sage-on-gentoo

(Alternative) Using Portage Repositories

Users may add the science and sage-on-gentoo overlays as repositories in portage without the need for layman. Both overlays are available via and portage is able to sync with them.

If not already present, first create a location for portage to store a local clone of the overlays.

root # mkdir /path/to/local-repos

Before configuring portage we will manually clone the two repositories into this local folder using dev-vcs/git. Starting with science for SageMath dependencies

root # cd /path/to/local-repos
root # git clone science

and then sage-on-gentoo for the actual SageMath ebuilds

root # git clone

The final step is to configure portage to be able to use these additional repositories. This is achieved by adding appropriate configuration settings to files saved within /etc/portage/repos.conf/. (More information on repositories can be found by reading man portage).

Using your favorite text editor, create and save the following file in /etc/portage/repos.conf/ for the science repository.

priority = 50
location = /path/to/local-repos/science
sync-type = git
sync-uri =
auto-sync = Yes

Now repeat the previous step for a second file in /etc/portage/repos.conf/ corresponding to the sage-on-gentoo repository.

priority = 50
location = /path/to/local-repos/sage-on-gentoo
sync-type = git
sync-uri =
auto-sync = Yes

The sage-on-gentoo repository has the repo_name 'sage-on-gentoo'. Setting the name in this .conf file to something else (e.g. "[sagemath]") will cause portage to complain.

If these previous steps are successful, portage will be able to access and update ebuilds within these two repositories. Initiate these repositories by simply running

root # emerge --sync

Ebuilds unmask

Before being able to install you may need to unmask the required ebuilds. You can use already-made files, shipped with overlay, such as: sage-on-gentoo/package.unmask/sage

To use this file permanently, place symbolic link to this file into your /etc/portage/package.unmask directory as shown below.

Default directory for layman overlays, if not set manually, is /var/lib/layman.

root #   ln -s /var/lib/layman/sage-on-gentoo/package.unmask/sage  /etc/portage/package.unmask/sage

Notice, that in this example, portage's package.unmask is directory , make sure to apply masks entries according to your preferred way of masks handle (directory or a flat file).

Use flags

Since Sage's ebuild requires its dependencies to be built with several USE- flags a standard package.use file is provided as well:

root #   ln -s <path-to-layman>/sage-on-gentoo/package.use/sage /etc/portage/package.use/sage

On a stable build installations you may also need following file:

root #    ln -s <path-to-layman>/sage-on-gentoo/package.use/sage-unstable /etc/portage/package.use/sage-unstable

With sage 6.8 a 99sage-doc-bin file installed that makes it easy to use pre-built html documentation. This is recommended for ~arch users.

Installing Sage

root # emerge -va sage

Please, note that this will pull in a lot of dependencies. If you can not proceed with this step (because of circular dependencies, missing USE-flags, and so on), report this behavior.

Using SageMath