⇦ Back

The base Octave programme you download and install is good but there is plenty more functionality available via packages. These are add-ons that can be installed on top of Octave.

The homepage for Octave packages is part of the Octave GitHub site. Some examples of packages that are there:

Installing

Ubuntu

For more info, see Octave for Debian systems on the Octave Wiki.

Firstly, you can obtain some additional features for Octave by installing liboctave-dev from the terminal via the following:

$ sudo apt-get install liboctave-dev

Some packages rely on this being installed to work. Once done, you can install the Octave packages that are distributed by Debian/Ubuntu:

$ sudo apt-get install octave-control
$ sudo apt-get install octave-image
$ sudo apt-get install octave-io
$ sudo apt-get install octave-optim
$ sudo apt-get install octave-signal
$ sudo apt-get install octave-statistics

To install additional packages, you have two options to try:

Option 1: Installing from the Octave Forge

Run the following from the Octave prompt (either in the GUI or in the terminal after having opened Octave by running octave):

octave:1> pkg install -forge {package_name}

where {package_name} is the name of the package you want.

If you get the following error:

error: the following dependencies were unsatisfied:

Then the packages listed under this message need to be installed first before you can install the package you want to.

If you get this error:

error: pkg: please install the Debian package "liboctave-dev" to get the mkoctfile command

You need liboctave-dev which, as mentioned above, you can install from the terminal with:

$ sudo apt-get install liboctave-dev

Option 2: Installing from your local machine

  • Download the package as a tarball (an archive file with the .tar.gz extension) from the Octave Packages page
  • Move it into you Octave folder (usually this will be /home/{your_username}/octave/)
  • Open Octave (either the GUI or in the terminal) and run the following from the command-line interface prompt:
octave:1> pkg install ~/octave/{package_name}.tar.gz

where {package_name} is the filename of the tarball you downloaded, eg fileio-1.2.2 for the fileio package.

For the image-acquisition package you might first need to install FLTK (Fast Light Toolkit):

  • Download the tarball (.tar.gz file) from the FLTK Download page
  • Unpack this in your Downloads folder
  • Open a terminal, change directory into the newly-created unpacked folder and make the install file:
cd ~/Downloads/fltk-1.3.8
sudo make install
  • You might then need to install libv4l-dev:
sudo apt-get install libv4l-dev

Windows

  • Download the package as a tarball (an archive file with the .tar.gz extension) from the Octave Packages page
  • Move it into the C: drive
  • Open Octave (either the GUI or in the Command Prompt) and run the following from the command-line interface:
octave:1> pkg install C:/{package_name}.tar.gz

where {package_name} is the filename of the tarball you downloaded, eg fileio-1.2.2 for the fileio package.

macOS

  • Download the package as a tarball (an archive file with the .tar.gz extension) from the Octave Packages page
  • Move it into your home directory (/Users/{your_username}/)
  • Open Octave (either the GUI or from the terminal by running octave) and run the following in the command-line prompt:
octave:1> pkg install {package_name}.tar.gz

where {package_name} is the filename of the tarball you downloaded, eg fileio-1.2.2 for the fileio package.

Check That It’s Worked

Once you’re finished installing packages you can open Octave (again, either the GUI or in a CLI by running octave) and run the following from the prompt:

octave:1> pkg list

This will display all the packages that have been installed and your new one(s) should be there.

Loading

Remember, once you’ve installed a package you still need to load it at the start of your script file before you can use it:

pkg load {package_name}

This should result in no message appearing. If the package hasn’t been installed properly or if there’s some mix-up with regards to which instance of Octave you are running it will say:

error: package {package_name} is not installed
error: called from
    load_packages at line 47 column 7
    pkg at line 588 column 7

Try re-installing the package and double-check which version of Octave you are using (octave --version) and where it is installed (which octave). It should be consistent: use the same instance of Octave to install and then use packages.

⇦ Back