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
  • 1
  • 4
  • 10
  • [Edit] your question and add the output of `apt-cache policy libosmesa6` – A.B. Sep 06 '15 at 12:28
  • Start the command `sudo apt-get install libgl1-mesa-glide3` and add the output into your question. – A.B. Sep 06 '15 at 12:33
  • @A.B. I have added the output in my question. Please have a look. Also, I would like to tell you I somehow installed `libosmesa6` but when I restarted my system, it started giving a blank screen. I ended up doing a fresh install of ubuntu. I later on read this `mesa` installation creates problems – Noober Sep 06 '15 at 12:34
  • @A.B. This is similar to what happened with me earlier- http://askubuntu.com/questions/299543/after-installing-mesa-ubuntu-doesnt-start-up – Noober Sep 06 '15 at 12:35
  • yes my ubuntu is 14.04 . – Noober Sep 06 '15 at 12:38
  • Give me the output of `apt-cache policy octave` – A.B. Sep 06 '15 at 12:38
  • @A.B. Added the output in my question – Noober Sep 06 '15 at 12:41
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/28836/discussion-between-a-b-and-noober). – A.B. Sep 06 '15 at 12:41
  • I have added a summary in my answer taken from the chat. :) – A.B. Sep 06 '15 at 15:54

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.
  • 89,123
  • 21
  • 245
  • 323
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
  • 193,181
  • 53
  • 473
  • 722
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,309
  • 17
  • 57
  • 80
  • 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