Unable to install python2.7-dev due to unmet dependencies Ubuntu 12.04

9,092

Solution 1

If you're not already, try changing your package repository reference to 'Main' or the United States. Doing this fixed my Python-dev unmet-dependencies problem (my 12.04 install was using the United Kingdom package repository, previously).

  1. In 'Ubuntu Software Center' (USC) go to the menu/tab 'Edit => Software Sources'.
  2. Change the 'Download from' drop-down value to 'Main Server' or a server in the United States.
  3. Leave USC, the open 'Update Manager' from Ubuntu's program menu, and 'Check' for software update (or issue 'sudo apt-get update' in a terminal window).
  4. Update your software as you normally would, e.g. via 'Update Manager' or apt-get/aptitude in a terminal.

This repaired my repository and I went on to install whatever I needed afterwards, as normal.

Before rectifying my problem with the above instructions, various aptitude/apt-get commands suggested that I remove many, many packages, but, as you can apreciate, I didn't fancy loosing my 6-months+ of package additions, and that's even though I snapshot the package list at times (see my gist for hints)! I'm really glad I found out about the instructions I'm leaving here.

Hope this helps.

Solution 2

In the end, I used Aptitude, which downgrades my Python version.

Share:
9,092

Related videos on Youtube

BananaOnTheWall
Author by

BananaOnTheWall

Learning is about today's you beating yesterday's you.

Updated on September 18, 2022

Comments

  • BananaOnTheWall
    BananaOnTheWall over 1 year

    Having exactly the same problem described on this page: http://qnundrum.com/answer.php?q=431114

    Below is directly quoted from that page:

    I am unable to install python-dev becasue of unmet dependancies. How can I get around this? Deleting python is not an option and I cant got back to python2.6-dev as it cant be found.

    sudo apt-get install python-dev
    

    The following packages have unmet dependencies: python-dev : Depends: python2.7-dev (>= 2.7.3) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

    So try python2.7-dev

    sudo apt-get install python2.7-dev
    
    The following packages have unmet dependencies:
    python2.7-dev :
        Depends: python2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed
        Depends: libpython2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed
    E: Unable to correct problems, you have held broken packages.
    

    So my question is how I can solve this problem without uninstall Python? Any advice would be really appreciated!

    • mgorven
      mgorven about 11 years
      Your installed python2.7 and libpython2.7 packages may be out of date, run apt-get update; apt-get dist-upgrade first.
    • Scott
      Scott about 6 years
      I found very easy solution. Check this link: askubuntu.com/a/922325/498798