3

I need to install python-dev in order to install another application, but when I do sudo apt-get install python-dev I get: The following packages have unmet dependencies: with a list of dependencies. So I added them until there were no more dependencies, leaving the command line as: sudo apt-get install python-dev libpython2.7-dev python2.7-dev libexpat1-dev libexpat1.

After this I get:

The following packages have unmet dependencies:
     libexpat1-dev : Depends: libexpat1 (= 2.1.0-6+b3) but 2.1.0-6+deb8u1 is to be installed
E: Unable to correct problems, you have held broken packages.

I opened Synaptic and searched for broken packages but there were none. I also tried to use aptitude instead of apt-get:

 The following NEW packages will be installed:
  libexpat1-dev{ab} libpython-dev{a} libpython2.7-dev{a} python-dev
  python2.7-dev{a}
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/19.0 MB of archives. After unpacking 31.6 MB will be used.
The following packages have unmet dependencies:
 libexpat1-dev : Depends: libexpat1 (= 2.1.0-6+b3) but 2.1.0-6+deb8u1 is installed.

 The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libexpat1-dev [Not Installed]                     
2)     libpython-dev [Not Installed]                     
3)     libpython2.7-dev [Not Installed]                   
4)     python-dev [Not Installed]                         
5)     python2.7-dev [Not Installed]

Accept this solution? [Y/n/q/?] 

So far so good (I thought), so I pressed 'Y', but it listed a lot of packages to remove and asked me to continue. Since I had doubts about this, I pressed 'n', but now when I do it all over again to copy the packages proposed for deletion, it does nothing:

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.

Any help will be greatly appreciated. Thanks in advance.

EDIT:

Right now I'm working with a Local Repository since I'm getting troubles to connect to the debian ftp (probably because of the network administrator or a proxy). So my sources.lst are:

#deb http://ftp.debian.org/debian/ jessie main contrib non-free
#deb-src http://ftp.debian.org/debian/ jessie main contrib non-free

#deb http://security.debian.org/ jessie/updates main contrib non-free
#deb-src http://security.debian.org/ jessie/updates main contrib non-free

# jessie-updates, previously known as 'volatile'
# A network mirror was not selected during install.  The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
#deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
#deb-src http://ftp.debian.org/debian/ jessie-updates main contrib non-free

##Local Repository
deb file:/media/ramon-debian/JimiHendrix/debian8repo/debian jessie main contrib non-free
deb file:/media/ramon-debian/JimiHendrix/debian8repo/debian stable main contrib non-free
  • Please post your sources.lst. Which version of Debian are you running? – Jan Oct 8 '15 at 20:27
  • I edited the question to post the sources.lst. I'm using debian 8. – Or10n Oct 8 '15 at 20:35
  • I found this one very useful. Check this out: askubuntu.com/a/922325/498798 – Sherzod Feb 6 '18 at 9:09
1

There is something wrong with the repository you're using. https://tracker.debian.org/pkg/expat shows that in Debian, there's no package libexpat1_2.1.0-6+b3...

Delete the apt cache using rm -rf /var/lib/apt/lists/* and then apt-get update again. If your local mirror is OK, you should have a working (consistent) list of available packages. If not, then the local repo is broken...

  • Thanks for the answer. I tried what you said, but it seems that my repo is broken as the matter of fact. I opened Synaptic and searched for python-dev and it says that the package is broken. – Or10n Oct 8 '15 at 21:05
2

Problem solved! I downloaded the packages libexpat1_2.1.0-7_amd64.deb and libexpat1-dev_2.1.0-7_amd64.deb from the link @Jan posted and installed them with dpkg -i package.deb.

  • I did that and also sudo apt-get build-dep python-dev then installed the python-dev after :D – Julio Marins Sep 8 '16 at 23:08
0

Use the aptitude tool - you'll see this suggestion a lot, but without instruction. I had a similar issue with a GNU Radio PyBOMBS build (on a Raspberry Pi 3b, FWIW) that no amount of changing mirrors, rm -rf /var/lib/apt/lists/*, or apt-get clean would fix.

Provided your mirror has the target package, the aptitude fix for me was to deny the first solution which, as you experienced, did nothing. Then, the second solution was a downgrade, which installed the needed dependency!

I would get:

libevent-dev : Depends: libevent-2.0-5 (= 2.0.21-stable-2) but 2.0.21-stable-2+deb8u1 is to be installed

This was the solution for me (for libevent-dev, but should work for libexpat1-dev):

# aptitude install libevent-dev
The following NEW packages will be installed:
  libevent-core-2.0-5{a} libevent-dev{b} libevent-extra-2.0-5{a} libevent-openssl-2.0-5{a} 
  libevent-pthreads-2.0-5{a} 
0 packages upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 506 kB of archives. After unpacking 1586 kB will be used.
The following packages have unmet dependencies:
 libevent-dev : Depends: libevent-2.0-5 (= 2.0.21-stable-2) but 2.0.21-stable-2+deb8u1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libevent-dev [Not Installed]                       

Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                                          
1)     libevent-2.0-5 [2.0.21-stable-2+deb8u1 (now) -> 2.0.21-stable-2 (stable)]

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libevent-2.0-5 
The following NEW packages will be installed:
  libevent-core-2.0-5{a} libevent-dev libevent-extra-2.0-5{a} libevent-openssl-2.0-5{a} 
  libevent-pthreads-2.0-5{a} 
0 packages upgraded, 5 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 641 kB of archives. After unpacking 1552 kB will be used.
Do you want to continue? [Y/n/?] y

After that, I could resume the PyBOMBS build with met dependencies (well, after doing a similar fix for libboost-dev...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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