Assuming a package is available in the file image-1.0.0.tar.gz it can be installed from the Octave prompt with the command
pkg install image-1.0.0.tar.gz
If the package is installed successfully nothing will be printed on
the prompt, but if an error occurred during installation it will be
reported. It is possible to install several packages at once by
writing several package files after the
pkg install command.
If a different version of the package is already installed it will
be removed prior to installing the new package. This makes it easy to
upgrade and downgrade the version of a package, but makes it
impossible to have several versions of the same package installed at
To see which packages are installed type
pkg list -| Package Name | Version | Installation directory -| --------------+---------+----------------------- -| image *| 1.0.0 | /home/jwe/octave/image-1.0.0
In this case only version 1.0.0 of the
image package is
'*' character next to the package name shows that the
image package is loaded and ready for use.
It is possible to remove a package from the system using the
pkg uninstall command like this
pkg uninstall image
If the package is removed successfully nothing will be printed in the
prompt, but if an error occurred it will be reported. It should be
noted that the package file used for installation is not needed for
removal, and that only the package name as reported by
should be used when removing a package. It is possible to remove
several packages at once by writing several package names after the
pkg uninstall command.
To minimize the amount of code duplication between packages it is
possible that one package depends on another one. If a package
depends on another, it will check if that package is installed
during installation. If it is not, an error will be reported and
the package will not be installed. This behavior can be disabled
by passing the -nodeps flag to the
pkg install -nodeps my_package_with_dependencies.tar.gz
Since the installed package expects its dependencies to be installed it may not function correctly. Because of this it is not recommended to disable dependency checking.
Manage or query packages (groups of add-on functions) for Octave.
Different actions are available depending on the value of command and on return arguments.
Install named packages. For example,
pkg install image-1.0.0.tar.gz
installs the package found in the file image-1.0.0.tar.gz. The file containing the package can be an url, e.g.
pkg install 'http://somewebsite.org/image-1.0.0.tar.gz'
installs the package found in the given url. This requires an internet connection and the cURL library.
Security risk: no verification of the package is performed before the installation. It has the same security issues as manually downloading the package from the given url and installing it.
No support: the GNU Octave community is not responsible for packages installed from foreign sites. For support or for reporting bugs you need to contact the maintainers of the installed package directly (see the DESCRIPTION file of the package)
The option variable can contain options that affect the manner in which a package is installed. These options can be one or more of
The package manager will disable dependency checking. With this option it is possible to install a package even when it depends on another package which is not installed on the system. Use this option with care.
A local installation (package available only to current user) is forced, even if the user has system privileges.
A global installation (package available to all users) is forced, even if the user doesn’t normally have system privileges.
Install a package directly from the Octave-Forge repository. This requires an internet connection and the cURL library.
Security risk: no verification of the package is performed before the installation. There are no signature for packages, or checksums to confirm the correct file was downloaded. It has the same security issues as manually downloading the package from the Octave Forge repository and installing it.
The package manager will print the output of all commands as they are performed.
Check installed Octave-Forge packages against repository and update any outdated items. This requires an internet connection and the cURL library. Usage:
Uninstall named packages. For example,
pkg uninstall image
image package from the system. If another installed
package depends on the
image package an error will be issued.
The package can be uninstalled anyway by using the -nodeps option.
Add named packages to the path. After loading a package it is possible to use the functions provided by the package. For example,
pkg load image
image package to the path.
Remove named packages from the path. After unloading a package it is no longer possible to use the functions provided by the package.
Show the list of currently installed packages. For example,
will produce a short report with the package name, version, and installation directory for each installed package. Supply a package name to limit reporting to a particular package. For example:
pkg list image
If a single return argument is requested then
pkg returns a cell
array where each element is a structure with information on a single
installed_packages = pkg ("list")
If two output arguments are requested
pkg splits the list of
installed packages into those which were installed by the current user,
and those which were installed by the system administrator.
[user_packages, system_packages] = pkg ("list")
"-forge" option lists packages available at the Octave-Forge
repository. This requires an internet connection and the cURL library.
oct_forge_pkgs = pkg ("list", "-forge")
Show a short description of installed packages. With the option
"-verbose" also list functions provided by the package. For
pkg describe -verbose
will describe all installed packages and the functions they provide. Display can be limited to a set of packages:
pkg describe control signal # describe control and signal packages
If one output is requested a cell of structure containing the description and list of functions of each package is returned as output rather than printed on screen:
desc = pkg ("describe", "secs1d", "image")
If any of the requested packages is not installed,
pkg returns an
error, unless a second output is requested:
[desc, flag] = pkg ("describe", "secs1d", "image")
flag will take one of the values
"Not loaded" for each of the named packages.
Set the installation prefix directory. For example,
pkg prefix ~/my_octave_packages
sets the installation prefix to ~/my_octave_packages. Packages will be installed in this directory.
It is possible to get the current installation prefix by requesting an output argument. For example:
pfx = pkg ("prefix")
The location in which to install the architecture dependent files can be independently specified with an addition argument. For example:
pkg prefix ~/my_octave_packages ~/my_arch_dep_pkgs
Set the file in which to look for information on locally installed packages. Locally installed packages are those that are available only to the current user. For example:
pkg local_list ~/.octave_packages
It is possible to get the current value of local_list with the following
Set the file in which to look for information on globally installed packages. Globally installed packages are those that are available to all users. For example:
pkg global_list /usr/share/octave/octave_packages
It is possible to get the current value of global_list with the following
Build a binary form of a package or packages. The binary file produced
will itself be an Octave package that can be installed normally with
pkg. The form of the command to build a binary package is
pkg build builddir image-1.0.0.tar.gz …
builddir is the name of a directory where the temporary
installation will be produced and the binary packages will be found.
The options -verbose and -nodeps are respected, while
all other options are ignored.
Rebuild the package database from the installed directories. This can be used in cases where the package database has been corrupted.
See also: ver, news.