2

I am trying to compile vim and install with "--enable-pythoninterp" flag, which needs the python-dev package.

INFO
I obtained the vim source from ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
Vim7.3 is not available yet using apt.
Using Ubuntu 10.10

But, sudo apt-get python-dev results in broken packages error message ->

The following packages have unmet dependencies:
python-dev : Depends: python (= 2.6.6-2ubuntu1) but 2.6.6-2ubuntu2 is to be installed
E: Broken packages

How can I best resolve this issue?


$ apt-cache policy vim python python-dev  
python:
  Installed: 2.6.6-2ubuntu2
  Candidate: 2.6.6-2ubuntu2
  Version table:
 *** 2.6.6-2ubuntu2 0
        100 /var/lib/dpkg/status
     2.6.6-2ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ maverick/main i386 Packages
vim:
  Installed: (none)
  Candidate: 2:7.2.330-1ubuntu4
  Version table:
     2:7.2.330-1ubuntu4 0
        500 http://archive.ubuntu.com/ubuntu/ maverick/main i386 Packages
python-dev:
  Installed: (none)
  Candidate: 2.6.6-2ubuntu1
  Version table:
     2.6.6-2ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ maverick/main i386 Packages

N 1.1
  • 129
  • Sorry, that should have been $ apt-cache policy vim python python-dev. That's what happens when you try to type half asleep. – Faheem Mitha Mar 22 '11 at 05:44
  • Ok. Does what I suggest below work for you? As Frederik pointed out, in this case, it may be a simple matter of updating your sources. However, this is a common situation, so it is good to know how to resolve it generally. – Faheem Mitha Mar 22 '11 at 06:05
  • @Faheem I have installed python2.7 & python2.7-dev for the meantime. – N 1.1 Mar 22 '11 at 07:03
  • This should be easy to fix using the information in the answers. python 2.7 is not the default python, and if you try to use it you will create new and unnecessary complications. – Faheem Mitha Mar 22 '11 at 07:47

3 Answers3

1

This is the usual message apt produces when you have have packages which are at different apt priority. See man apt_preferences. python 2.6.6-2ubuntu1 is not of sufficiently high priority to be installed, so apt is trying to install 2.6.6-2ubuntu2, which does not satisfy the dependency. More information is needed to resolve this. Please provide the output of

$ apt-cache policy vim python python-dev

Also post your /etc/apt/preferences and /etc/apt/sources.list files. Also give details of how you obtained the vim source. Is this an upstream source? Did you download the source using apt-get source or similar? If I understood this correctly, you are trying to install a customized version of the vim package. Is that correct?

Based on your apt-cache policy output, you just need to downgrade python from 2.6.6-2ubuntu2 to 2.6.6-2ubuntu1. As you can see, it does not currently correspond to any version in the archives. Do you know where you got it from? So do

$ apt-get install python=2.6.6-2ubuntu1

and then try your

$ sudo apt-get install python-dev

again.

Faheem Mitha
  • 35,108
  • I have un-installed vim. So, apt-cache vim policy python python-dev is giving error. Post updated. – N 1.1 Mar 22 '11 at 05:29
  • updated post with output for apt-cache policy vim python python-dev. – N 1.1 Mar 22 '11 at 06:02
  • If i am downloading from the main server, how was python2.6.6-2ubuntu2 installed? How do I reset my apt?? – N 1.1 Mar 25 '11 at 10:10
  • I tried sudo aptitude install python=2.6.6-2ubuntu1 but aptitude asks me to remove virtually everything. look at the output. http://pastie.org/1712658 – N 1.1 Mar 25 '11 at 10:11
  • @N 1.1: Don't try and downgrade to a specific version. It may be that 2.6.6-2ubuntu2 (for example) is now the current stable, so that would be the wrong thing to do. Also, try using apt-get not aptitude. First run apt-get update, then apt-get install python/stable python-dev/stable. This is basically what Frederik was suggesting above, but will force a downgrade to stable if necessary. Also, please update your output of apt-cache policy vim python python-dev above. Incidentally, using a username with no spaces would be preferable, I don't know if the notify system has problems with such. – Faheem Mitha Mar 25 '11 at 17:48
1

It looks like your update got the packages in between uploads of packages: http://packages.ubuntu.com/maverick-updates/python-dev both versions should be 2.6.6-2ubuntu2. I'd try:

apt-get update

and then retry

apt-get update
apt-get install python python-dev

If this does not work, I'd try switching to another ubuntu mirror to get the packages from there.

0

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.

Big Rich
  • 101
  • 2