Sage package management commands

A Sage package has the extension .spkg. It is a tarball that is (usually) bzip2 compressed that contains arbitrary data and an spkg-install file. An Sage package typically has the following components:

  • spkg-install - shell script that is run to install the package
  • Sage.txt - file that describes how the package was made, who maintains it, etc.
  • sage - directory with extra patched version of files that needed during the install

Use the install_package command to install a new package, and use optional_packages to list all optional packages available on the central Sage server. The upgrade command upgrades all standard packages - there is no auto-upgrade command for optional packages.

All package management can also be done via the Sage command line.

sage.misc.package.experimental_packages()

Return two lists. The first contains the installed and the second contains the not-installed experimental packages that are available from the Sage repository. You must have an internet connection.

OUTPUT:

  • installed experimental packages (as a list)
  • NOT installed experimental packages (as a list)

Use install_package(package_name) to install or re-install a given package.

sage.misc.package.install_all_optional_packages(force=True, dry_run=False)

Install all available optional spkg’s in the official Sage spkg repository. Returns a list of all spkg’s that fail to install.

INPUT:
force – bool (default: True); whether to force reinstall of
spkg’s that are already installed.
dry_run – bool (default: False); if True, just list the
packages that would be installed in order, but don’t actually install them.
OUTPUT:
list of strings

NOTE: This is designed mainly for testing purposes. This also doesn’t do anything with respect to dependencies – the packages are installed in alphabetical order. Dependency issues will be dealt with in a future version.

AUTHOR:
– William Stein (2008-12)
EXAMPLES:
sage: sage.misc.package.install_all_optional_packages(dry_run=True) # optional - internet Installing ... []
sage.misc.package.install_package(package=None, force=False)

Install a package or return a list of all packages that have been installed into this Sage install.

You must have an internet connection. Also, you will have to restart Sage for the changes to take affect.

It is not needed to provide the version number.

INPUT:

  • package - optional; if specified, install the given package. If not, list all installed packages.

IMPLEMENTATION: calls ‘sage -f’.

sage.misc.package.is_package_installed(package)

Return true if a package starting with the given string is installed.

EXAMPLES:

sage: is_package_installed('sage') 
True
sage.misc.package.optional_packages()

Return two lists. The first contains the installed and the second contains the not-installed optional packages that are available from the Sage repository. You must have an internet connection.

OUTPUT:

  • installed optional packages (as a list)
  • NOT installed optional packages (as a list)

Use install_package(package_name) to install or re-install a given package.

sage.misc.package.package_mesg(package_name)
sage.misc.package.standard_packages()

Return two lists. The first contains the installed and the second contains the not-installed standard packages that are available from the Sage repository. You must have an internet connection.

OUTPUT:

  • installed standard packages (as a list)
  • NOT installed standard packages (as a list)

Use install_package(package_name) to install or re-install a given package.

sage.misc.package.upgrade()

Download and build the latest version of Sage.

You must have an internet connection. Also, you will have to restart Sage for the changes to take affect.

This upgrades to the latest version of core packages (optional packages are not automatically upgraded).

This will not work on systems that don’t have a C compiler.

Previous topic

Constant functions

Next topic

A tool for inspecting Python pickles

This Page