5

I am trying to install Octave by using these commands:

sudo apt-add-repository ppa:octave/stable
sudo apt-get update
sudo apt-get install octave

But I am getting the following error message:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 octave : Depends: libosmesa6 (>= 6.5.2-1) but it is not going to be installed or
                   libgl1-mesa-glide3 but it is not installable
E: Unable to correct problems, you have held broken packages.

How do I fix this problem?

Edit- Output for apt-cache policy libosmesa6

libosmesa6:
  Installed: (none)
  Candidate: 10.1.3-0ubuntu0.4
  Version table:
     10.1.3-0ubuntu0.4 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
     10.1.0-4ubuntu5 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Edit2- Output for apt-cache policy octave

octave:
  Installed: (none)
  Candidate: 4.0.0-3ubuntu2~octave~trusty1
  Version table:
     4.0.0-3ubuntu2~octave~trusty1 0
        500 http://ppa.launchpad.net/octave/stable/ubuntu/ trusty/main amd64 Packages
     3.8.1-1ubuntu1 0
        500 http://in.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
Noober
  • 277

3 Answers3

4

This is no universal answer. The problem was complex and was dissolved by a longer analysis in the chat.

Here is a summary from the chat.

sudo apt-get install libosmesa6
sudo apt-get install libglapi-mesa

It removed a lot of packages, eg ubuntu-desktop

sudo apt-get install -f
sudo apt-get install ubuntu-desktop

From here, we used aptitude, a better problem resolver

sudo aptitude install libgl1-mesa-dri

Now a lot of packages was removed, but ubuntu-desktop is installed.

sudo aptitude install unity8
sudo aptitude install octave

Done

A.B.
  • 90,397
2

The following worked for me at the end on a Ubuntu 14.04 64-bit machine.

In terminal, install:

sudo apt-get build-dep octave
sudo apt-get install libqt4-opengl-dev

Then download and build Octave from source:

wget ftp://ftp.gnu.org/gnu/octave/octave-4.0.0.tar.xz
tar -xaf octave-4.0.0.tar.xz
cd octave-4.0.0
./configure
make
sudo make install

This worked on all the machines I tried in my laboratory.

muru
  • 197,895
  • 55
  • 485
  • 740
1

Open terminal and run the following command:

sudo apt-get build-dep octave

This will install all dependencies for Octave,

refer here

After that You can use what you followed for installation

Or

 sudo add-apt-repository ppa:picaso/octave
 sudo apt-get update
 sudo apt-get install octave

Refer here

Ravan
  • 9,379
  • note that this will use more space and that installing only what is in the dependency error is usually more productive – David Sep 06 '15 at 04:45
  • 2
    @David cole I tried your command and error : The following packages have unmet dependencies: libosmesa6 : Depends: libglapi-mesa (= 10.1.3-0ubuntu0.4)E: Unable to correct problems, you have held broken packages. – Ravan Sep 06 '15 at 04:49
  • It means instead of adding each dependency it is better to have all dependencies,@DavidCole – Ravan Sep 06 '15 at 04:50
  • 3
    -1 One doesn't need the build dependencies of a package to run the software of the binary package. – David Foerster Sep 06 '15 at 08:22