Why is python-pip kept back in Ubuntu 14.04?

7,750

Solution 1

When a package is marked as being 'kept back', this means that apt will not auto-update it as it now has a new, extra dependency that you never agreed to install. When you install it specifically with sudo apt-get install python-pip, it returns the message saying that the following packages will be installed to satisfy the dependency requirements:

python-chardet-whl python-colorama-whl python-distlib-whl 
python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
python-six-whl python-urllib3-whl

These are all new packages that are not present on your system. Rather than assume you want them installed, apt 'holds back' the package until you specifically tell it to install it. If you don't mind these new packages being installed (you probably don't), then agree to the installation.

If you want to upgrade everything and don't mind installing any new dependencies, the command sudo apt-get dist-upgrade will install all upgrades and pull in any new dependencies required for the updated packages. Be careful because sometimes a new dependency means that an entire software package gets pulled in (e.g. gnome-desktop will require downloading and installing a bunch of dependencies).

Solution 2

In your case run

sudo apt-get dist-upgrade

instead of

sudo apt-get upgrade

To see the differences, read the man-page:

man apt-get

upgrade

Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, nor are packages that are not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

dist-upgrade

In addition to performing the function of upgrade, this option also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones, if necessary.
The /etc/apt/sources.list(5) file contains a list of locations from which to retrieve desired package files. See also apt_preferences(5) for a mechanism for over-riding the general settings for individual packages.
Share:
7,750

Related videos on Youtube

eccstartup
Author by

eccstartup

I love Haskell. Sometimes, trouble-maker.

Updated on September 18, 2022

Comments

  • eccstartup
    eccstartup over 1 year

    When I upgrade these days, I get this message:

    $ sudo apt-get upgrade -y
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Calculating upgrade... Done
    The following packages have been kept back:
      libhwloc-plugins linux-headers-generic linux-signed-generic
      linux-signed-image-generic python-pip
    0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
    

    I don't understand why python-pip is kept back. Is it because I have updated it by pip already?

    $ pip -V
    pip 7.0.3 from /usr/local/lib/python2.7/dist-packages (python 2.7)
    

    Is it safe now to upgrade python-pip with apt-get?


    Update:

    $ sudo apt-get install python-pip
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following extra packages will be installed:
      python-chardet-whl python-colorama-whl python-distlib-whl
      python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
      python-six-whl python-urllib3-whl
    Recommended packages:
      python-dev-all python-wheel
    The following NEW packages will be installed:
      python-chardet-whl python-colorama-whl python-distlib-whl
      python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
      python-six-whl python-urllib3-whl
    The following packages will be upgraded:
      python-pip
    1 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
    Need to get 1,193 kB of archives.
    After this operation, 1,438 kB of additional disk space will be used.
    
    • muru
      muru almost 9 years
      Run sudo apt-get install python-pip. It will report why it's being kept back.
    • muru
      muru almost 9 years
      Stack Exchange doesn't support triple-backquote code blocks. Just select the text and press Ctrl-K to let it format.
  • eccstartup
    eccstartup almost 9 years
    Would you kindly explain my sudo apt-get install python-pip result?
  • Aaron D
    Aaron D almost 9 years
    Sure. I edited my answer.
  • eccstartup
    eccstartup almost 9 years
    I wonder if dist-upgrade will help me upgrade to 14.10 by accident?
  • eccstartup
    eccstartup almost 9 years
    Besides, I think have to upgrade kernel with dist-upgrade. Isn't there a restart required?
  • A.B.
    A.B. almost 9 years
    dist-upgrade doesn't affects your Ubuntu release. And yes, after a kernel upgrade, a restart is recommended.