Listing Sage packages

This module can be used to see which Sage packages are installed and which packages are available for installation.

For more information about creating Sage packages, see the “Packaging Third-Party Code” section of the Sage Developer’s Guide.

Actually installing the packages should be done via the command line, using the following commands:

  • sage -i PACKAGE_NAME – install the given package
  • sage -f PACKAGE_NAME – re-install the given package, even if it was already installed

Packages available

Standard packages:

atlas flintqs libgd pari_seadata_small rubiks
backports_ssl_match_hostname freetype libpng pari rw
boehm_gc gap linbox patch sage_root
boost_cropped gd lrcalc pexpect sage_scripts
brial gdmodule m4ri pil sage
bzip2 genus2reduction m4rie pillow sagenb
cddlib gf2x markupsafe pip sagetex
cephes gfan mathjax pkgconf scipy
certifi git matplotlib pkgconfig setuptools
cliquer givaro maxima planarity singular
combinatorial_designs glpk mercurial polytopes_db six
conway_polynomials graphs mistune ppl sphinx
cvxopt gsl mpc pycrypto sqlalchemy
cython iconv mpfi pygments sqlite
dateutil iml mpfr pynac symmetrica
docutils ipython mpmath pyparsing sympow
ecl jinja2 ncurses python sympy
eclib jmol networkx pyzmq tachyon
ecm jsonschema ntl r tornado
elliptic_curves lcalc numpy ratpoints zeromq
fflas_ffpack libfplll palp readline zlib
flint libgap pari_galdata rpy2 zn_poly

Optional packages:

PyQt_x11 cunningham_tables gcc lie plantri
TOPCOM d3js gdb lrslib pybtex
arb database_cremona_ellcurve giac mcqd python2
beautifulsoup database_gap giacpy modular_decomposition python3
benzene database_jones_numfield ginv mpi4py pyx
biopython database_kohel git_trac mpir qhull
bliss database_odlyzko_zeta gmp nauty sage_mode
brian database_pari gnuplotpy normaliz scons
buckygen database_stein_watkins_mini guppy nose sip
cbc database_stein_watkins java3d nzmath termcap
ccache database_symbolic_data kash3 openmpi threejs
chomp dot2tex knoboo openssl tides
cluster_seed extra_docs libogg ore_algebra topcom
coxeter3 gambit libtheora p_group_cohomology trac
cryptominisat gap_packages lidia phc  

Experimental packages:

4ti2 dvipng mayavi pygtk sip
PyQt4 ets meataxe pynifti soya_cvs
PyVTK fes modglue pyqt soya
QScintilla2 flex mpich2 pyrexembed superlu
asymptote fricas numarray qasm surf
autotools gnofract4d numeric qepcad valgrind
bison gnuplot openopt quantlib_swig vtk_meta
cadabra graphviz pcre quantlib wxPython
clapack latte_int phcpack reallib3_linux yafray
clisp libcprops polymake sandpile yassl
cmake libjpeg processing scitools++  
compilerwrapper libsigsegv pygame semigroupe  
csdp macaulay2 pygsl simpqs  

Functions

exception sage.misc.package.PackageNotFoundError

Bases: exceptions.RuntimeError

This class defines the exception that should be raised when a function, method, or class cannot detect a Sage package that it depends on.

This exception should be raised with a single argument, namely the name of the package.

When an PackageNotFoundError is raised, this means one of the following:

  • The required optional package is not installed.
  • The required optional package is installed, but the relevant interface to that package is unable to detect the package.

EXAMPLES:

sage: from sage.misc.package import PackageNotFoundError
sage: raise PackageNotFoundError("my_package")
Traceback (most recent call last):
...
PackageNotFoundError: the package 'my_package' was not found. You can install it by running 'sage -i my_package' in a shell
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)

Run sage -i package_name from a shell to install a given package or sage -f package_name to re-install it.

EXAMPLE:

sage: from sage.misc.package import experimental_packages
sage: installed, not_installed = experimental_packages() # optional internet
sage: min(installed+not_installed)                   # optional internet
'4ti2'
sage: max(installed+not_installed)                   # optional internet
'yassl'
sage.misc.package.install_package(package=None, force=None)

This function is obsolete. Run sage -i PKGNAME from a shell to install a package. Use the function installed_packages() to list all installed packages.

TESTS:

sage: install_package()
doctest:...: DeprecationWarning: use installed_packages() to list all installed packages
See http://trac.sagemath.org/16759 for details.
[...'arb...'python...]
sage: install_package("autotools")
Traceback (most recent call last):
...
NotImplementedError: installing Sage packages using 'install_package()' is obsolete.
Run 'sage -i autotools' from a shell prompt instead
sage.misc.package.installed_packages()

Return a list of all installed packages, with version numbers.

EXAMPLES:

sage: installed_packages()
[...'arb...'python...]
sage.misc.package.is_package_installed(package)

Return true if package is installed.

EXAMPLES:

sage: is_package_installed('pari')
True

Giving just the beginning of the package name is not good enough:

sage: is_package_installed('matplotli')
False

Otherwise, installing “pillow” will cause this function to think that “pil” is installed, for example.

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)

Run sage -i package_name from a shell to install a given package or sage -f package_name to re-install it.

EXAMPLE:

sage: from sage.misc.package import optional_packages
sage: installed, not_installed = optional_packages() # optional internet
sage: min(installed+not_installed)                   # optional internet
'PyQt_x11'
sage: max(installed+not_installed)                   # optional internet
'trac'
sage.misc.package.package_versions(package_type, local=False)

Return version information for each Sage package.

INPUT:

  • package_type (string) – one of "standard", "optional" or "experimental"
  • local (boolean) – only query local data (no internet needed)

For packages of the given type, return a dictionary whose entries are of the form 'package': (installed, latest), where installed is the installed version (or None if not installed) and latest is the latest available version. If the package has a directory in SAGE_ROOT/build/pkgs/, then latest is determined by the file package-version.txt in that directory. If local is False, then Sage’s servers are queried for package information.

EXAMPLES:

sage: std = package_versions('standard', local=True)
sage: 'gap' in std
True
sage: std['zn_poly']
('0.9.p11', '0.9.p11')
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)

Run sage -i package_name from a shell to install a given package or sage -f package_name to re-install it.

EXAMPLE:

sage: from sage.misc.package import standard_packages
sage: installed, not_installed = standard_packages() # optional internet
sage: installed[0], installed[-1]                    # optional internet
('atlas', 'zn_poly')
sage: 'mercurial' in not_installed                   # optional internet
True
sage.misc.package.upgrade()

Obsolete function, run ‘sage –upgrade’ from a shell prompt instead.

TESTS:

sage: upgrade()
Traceback (most recent call last):
...
NotImplementedError: upgrading Sage using 'upgrade()' is obsolete.
Run 'sage --upgrade' from a shell prompt instead