Friday, June 15, 2012

Ubuntu Tip 02: Octave 3.6.1 in Ubuntu 12.04

UPDATE: Ubuntu 12.10 comes with Octave 3.6 and also the extra packages are in the repositories. It's better if you install directly from the repositories instead of using this steps, because it's easier to remove the extra packages later.



Last time I showed you how to get octave to run on the guake terminal at startup. For that tutorial, Octave 3.2, which is available in the universe repository, was used. This time, I'll show you how to install the version 3.6.1.

Normally installing Octave would require compiling from the source, which can take a few hours. Luckily, picaso has already done the hard job and has packed the compiled source in a nice PPA (launchpad.net).

The installations steps are shown below, the first step is for those who have already installed octave 3.2

sudo apt-get remove octave # If you have installed octave 3.2
sudo apt-add-repository ppa:picaso/octave
sudo apt-get update
sudo apt-get install octave

Congratulations, you have installed a newer version of octave and have access to the core functions of Octave.

 If you are interested in more advanced functions for image processing, signal processing, control systems, etc. Then you need to get additional "packages" from here (sourceforge.net).

These extras packages must be compiled into our new Octave installation, and to compile them we need the "pkg" commands, which can be obtained using the following command.

sudo apt-get install liboctave-dev

(Note: Thanks to picaso for pointing out that octave-pkg-dev is deprecated, and that liboctave-dev should be used instead)

Using an example, I'll show the installation process of an Octave package.

 Let's say we want to install the "signal" package. First check the details of the package here. You'll notice that there are many dependencies that must be installed in the following order:


After downloading all the necessary packages, we proceed to compile them in octave:

sudo octave
# The following commands must be executed inside a rooted octave
cd /path/to/the/downloaded/packages
pkg install miscellaneous-1.1.0.tar.gz -auto
pkg install struct-1.0.10.tar.gz -auto
pkg install optim-1.2.0.tar.gz -auto
pkg install specfun-1.1.0.tar.gz -auto
pkg install control-2.3.51.tar.gz -auto
pkg install signal-1.1.3.tar.gz -auto
pkg install image-1.0.15.tar.gz -auto

(Note: The -auto modifier, tells the package manager to load that specific package when octave starts. For more information check "help pkg" in octave)

We're done, now we can start using the advanced features of octave (You might need to restart octave to enable the just installed packages).





8 comments:

  1. Hi, I'm glad you found my PPA. But:

    octave-pkg-dev is deprecated. It looks like you are installing octave3.6 from my PPA, then immediately uninstalling it by issuing sudo apt-get install octave-pkg-dev, which will reinstall octave3.2

    I suggest you check which version of octave you have running because it might not be the one you think.

    If you want to use octave3.6 you should use sudo apt-get install liboctave-dev ##instead of octave-pkg-dev##.

    ReplyDelete
    Replies
    1. Hello picaso

      First of all, thanks for providing this PPA to the community. I do have the version 3.6.1 of Octave and I used the steps on this post, however I did the installation a few months ago.

      I'll re-test these steps on another computer, and update the post if necessary.

      Thanks

      Delete
    2. picaso,

      As you pointed out, using octave-pkg-dev rolls back octave to the version 3.2. I have updated the post addressing this issue, and now liboctave-dev is used, as you suggested.

      I checked my installed packages and liboctave-dev is among them, even when I used the old steps and installed octave-pkg-dev months ago...

      Delete
  2. I could not install specfun package.

    ellipj.cc:41:17: fatal error: oct.h: No such file or directory
    compilation terminated.

    Do you know how to solve this?

    Thanks.

    ReplyDelete
    Replies
    1. Hello arie,

      Sorry for the late reply. The problem seems like a missing development library. Do you have installed the liboctave-dev package?

      I'm afraid that I can't provide any more help, I've already moved to Ubuntu 12.10; and in that version octave 3.6 is already in the universe repository so I can't test these steps.

      Good luck.

      Delete
  3. Hi, great post!
    However, I found one mistake - signal package should be installed before image package (because image depends on signal).

    Thanks!

    ReplyDelete
    Replies
    1. Hello Olek,

      You're right, however I don't think it was this way before, maybe they changed the dependencies? or maybe I was wrong from the beginning...

      I swapped the order in the post.

      Thanks!

      Delete
  4. On my system it asked for the general package as well... after adding it to the list (first) the rest seemed to compile fine.

    Thanks for putting this up!

    ReplyDelete