Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command $ sudo apt-get install python2.7-dev yields this result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
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:
 python2.7-dev : Depends: libexpat1-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

I have run sudo apt-get update, sudo apt-get upgrade and sudo apt-get dist-upgrade before running the install command. I have tried switching the repository server from my local server (Czech Republic) to the Main server. I have tried installing the package using aptitude, the result was:

The following NEW packages will be installed:
  libexpat1-dev{ab} libssl-dev{a} libssl-doc{a} python2.7-dev 
0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 32.4 MB of archives. After unpacking 47.9 MB will be used.
The following packages have unmet dependencies:
 libexpat1-dev : Depends: libexpat1 (= 2.0.1-7.2ubuntu1.1) but 2.1.0-1ubuntu1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libexpat1-dev [Not Installed]                      
2)     python2.7-dev [Not Installed]                      

Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

The aptitude's suggested "solution" doesn't actually do anything and has no effect. After printing out the above, it exists without an error code or any error message.

I have tried removing libexpat1, but way too many packages I need depend on it including, it seems, huge chunk of gnome.

None of the things I have tried had any effect, the result of the install command was still the same.

I have searched the web for the issue and found few posts that seem to be related to my problem, but though they may be "resolved", none of them helped me in any way (here are the two I didn't close before asking this question):

  1. Unable to install python2.7-dev due to unmet dependencies Ubuntu 12.04
share|improve this question
up vote 1 down vote accepted

The interesting bit here is:

libexpat1-dev : Depends: libexpat1 (= 2.0.1-7.2ubuntu1.1) but 2.1.0-1ubuntu1 is installed.

According to the online package search tool, 12.04 LTS ships libexpat1 version 2.0.1-7.2ubuntu1.1 for both precise and precise-updates. The question is, how did you get version 2.1.0-1ubuntu1 installed in the first place?

Using the aptitude() interactive UI, you can search for libexpat1, and select the appropriate version for installation, i.e., downgrade the package to match the libexpat1-dev dependency.

You can do that from the command-line as well:

sudo aptitude install package=version
share|improve this answer
Thank you very much, sir! Seems to work. For the completeness sake, the specific command I used was sudo aptitude install libexpat1=2.0.1-7.2ubuntu1.1. It left some dependencies unresolved (something involving Python 3 and apport), I hope it's not something that is going to bite me in the behind later. – Honza Jun 23 '13 at 10:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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