This question already has an answer here:

The issue:

Let say I have a PPA for a software (i.e. Blender for example; http://ppa.launchpad.net/thomas-schiex/blender/ubuntu ) that contains for some reasons, a Python3.6 version.

What I want to achieve:

Let say I want "a better" Python3.6 package, for example from a python dedicated ppa, in my case; http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu

The question:

How does apt chose which package to install and is there a way I can tell apt to install it from one desired ppa upon the others?
I guess it will chose the most up-to-date package (am I wrong?), but what if for some reasons I want to keep a specific older version?

The example with python3.6 is "only" an example here, this may be useful for any packages.

Note about the dupplicate:
Even if the answer in the suggested links in the comments are the same, the entry points, i.e. "the question" is note exactly the same and lots of people may come to the answer through this search result instead of the other. So, in my humble opinion and strictly speaking, the answer is somewhat a dupplicate, not the question.

marked as duplicate by muru, karel, David Foerster, Braiam apt Aug 16 at 11:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Volker Seigel's answer covers all questions here, I think. – muru Aug 15 at 7:33
  • "lots of people may come to the answer through this search result instead of the other" - that's the whole point of duplicates. – muru Aug 16 at 7:16
  • Yes and no. If you have one specific problem, like I did, you naturaly won't search for something other if you didn't faced it aswell, even if the answer is the same. That's why I didn't found the other threads; I had in mind the specific "double PPA" issue, nothing related to "one PPA and the software center". But the answer works for both, that's true. The problem with "answers" is that you don't already have them in mind when you face a problem! – s.k Aug 16 at 8:42
  • so ... you agree that closing this as a duplicate will only help people who have different conceptions of the same problem? After all 2 PPAs or 1 PPA and 1 software center - both are just two software sources. – muru Aug 16 at 8:46
  • @muru that the answer on that question solves this one, doesn't mean that it is the correct duplicate. I used instead the question that asks what OP asks about and also have the answers that would solve OP issue. – Braiam Aug 16 at 11:46
up vote 5 down vote accepted

As you guessed apt is going to install the latest version available in your sources.

For example:

$ apt-cache madison firefox

   firefox | 61.0.1+build1-0ubuntu0.18.04.1 | http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
   firefox | 61.0.1+build1-0ubuntu0.18.04.1 | http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
   firefox | 59.0.2+build1-0ubuntu1 | http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

As you can see there are two different version of Firefox available for me to install, let's check which one is going to be installed:

$ apt-cache policy firefox | head -3
firefox:
  Installed: (none)
  Candidate: 61.0.1+build1-0ubuntu0.18.04.1

As you can see the latest version is going to be installed (it's the candidate for installation)

You can use:

sudo apt install package-name=version

for example:

sudo apt install firefox=59.0.2+build1-0ubuntu1

to install an older version of a software.

As an alternative to pining , you can apt-mark to stop it from being upgraded:

sudo apt-mark hold firefox

Not the answer you're looking for? Browse other questions tagged or ask your own question.