### Navigation

- index
- modules |
- next |
- previous |
- Miscellaneous »

# 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.

  See also

  `install_package()`, `upgrade()`

`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.
  - `force` – boolean (default: `False`); if `True`, reinstall the package given if it is already installed. (Otherwise, an already installed package doesn’t get reinstalled, as with ‘sage -i ...’.)

  EXAMPLES:

  With no arguments, list the installed packages:

      sage: install_package()
      [...'atlas...'python...]

  With an argument, install the named package:

      sage: install_package('chomp')  # not tested
      Attempting to download package chomp-20100213.p2
      ...

  IMPLEMENTATION:

  Calls ‘sage -f ...’ to (re)install the package if a package name is given. If no package name is given, simply list the contents of `spkg/installed`.

  See also

  `optional_packages()`, `upgrade()`

`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.

  See also

  `install_package()`, `upgrade()`

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

  x.__init__(...) initializes x; see help(type(x)) for signature

`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.

  See also

  `install_package()`, `upgrade()`

`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.

  See also

  `install_package()`, `optional_packages()`

### Navigation

- index
- modules |
- next |
- previous |
- Miscellaneous »