tested on: Linux debian7 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux

here an example how aptitude can resolve a problem that apt can’t resolve (easily).

how to solve the problem:

#!/bin/bash

# the problem:

dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)

dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
aptitude is better at resolving dependencies as apt.

apt-get -f install; # sometimes this can help, but did not

aptitude install python2.7; # the solution

how it started:

root@debian7:/var/www# apt-get update;apt-get -y upgrade;
Hit http://ftp.de.debian.org stable Release.gpg
Hit http://security.debian.org wheezy/updates Release.gpg
Hit http://security.debian.org wheezy/updates Release
Hit http://ftp.de.debian.org stable Release
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/contrib Sources
Hit http://security.debian.org wheezy/updates/non-free Sources
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://ftp.de.debian.org stable/main Sources
Hit http://security.debian.org wheezy/updates/contrib amd64 Packages
Hit http://ftp.debian.org wheezy-updates Release.gpg
Hit http://security.debian.org wheezy/updates/non-free amd64 Packages
Hit http://ftp.de.debian.org stable/contrib Sources
Hit http://security.debian.org wheezy/updates/contrib Translation-en
Hit http://security.debian.org wheezy/updates/main Translation-en
Hit http://security.debian.org wheezy/updates/non-free Translation-en
Hit http://ftp.debian.org wheezy-updates Release
Hit http://ftp.de.debian.org stable/non-free Sources
Hit http://ftp.de.debian.org stable/main amd64 Packages
Hit http://ftp.debian.org wheezy-updates/main Sources
Hit http://ftp.de.debian.org stable/contrib amd64 Packages
Hit http://ftp.de.debian.org stable/non-free amd64 Packages
Hit http://ftp.debian.org wheezy-updates/contrib Sources
Hit http://ftp.de.debian.org stable/contrib Translation-en
Hit http://ftp.debian.org wheezy-updates/non-free Sources
Hit http://ftp.de.debian.org stable/main Translation-en
Hit http://ftp.debian.org wheezy-updates/main amd64 Packages/DiffIndex
Hit http://ftp.de.debian.org stable/non-free Translation-en
Hit http://ftp.debian.org wheezy-updates/contrib amd64 Packages
Hit http://ftp.debian.org wheezy-updates/non-free amd64 Packages
Hit http://ftp.debian.org wheezy-updates/contrib Translation-en
Hit http://ftp.debian.org wheezy-updates/main Translation-en/DiffIndex
Hit http://ftp.debian.org wheezy-updates/non-free Translation-en
Reading package lists... Done
W: Duplicate sources.list entry http://security.debian.org/ wheezy/updates/main amd64 Packages (/var/lib/apt/lists/security.debian.org_dists_wheezy_updates_main_binary-amd64_Packages)
W: You may want to run apt-get update to correct these problems
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
accountsservice acpid alacarte apache2.2-bin apt apt-utils apt-xapian-index aptitude aptitude-common at-spi2-core avahi-daemon baobab base-passwd bind9-host bluez brasero
brasero-common bsdutils caribou caribou-antler cheese-common colord consolekit cpp cron cryptsetup-bin cups-pk-helper dbus dconf-gsettings-backend dconf-service dconf-tools
default-jre default-jre-headless dictionaries-common dmsetup dnsmasq-base dpkg empathy empathy-common eog evince evince-common evolution-data-server evolution-data-server-common
exim4 exim4-base exim4-config exim4-daemon-light fakeroot filezilla filezilla-common fontconfig fontconfig-config gcalctool gcc gconf-service gconf2 gconf2-common gcr gdm3 geoclue
geoclue-hostip geoclue-localnet geoclue-manual geoclue-yahoo ghostscript gir1.2-accountsservice-1.0 gir1.2-atk-1.0 gir1.2-atspi-2.0 gir1.2-caribou-1.0 gir1.2-clutter-1.0
gir1.2-clutter-gst-1.0 gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gir1.2-evince-3.0 gir1.2-folks-0.6 gir1.2-freedesktop gir1.2-gck-1 gir1.2-gcr-3 gir1.2-gdkpixbuf-2.0 gir1.2-gkbd-3.0
gir1.2-glib-2.0 gir1.2-gmenu-3.0 gir1.2-gnomebluetooth-1.0 gir1.2-gtk-3.0 gir1.2-gtkclutter-1.0 gir1.2-gtksource-3.0 gir1.2-json-1.0 gir1.2-mutter-3.0 gir1.2-networkmanager-1.0
gir1.2-panelapplet-4.0 gir1.2-pango-1.0 gir1.2-peas-1.0 gir1.2-polkit-1.0 gir1.2-soup-2.4 gir1.2-telepathyglib-0.12 gir1.2-telepathylogger-0.2 gir1.2-upowerglib-1.0 gjs gkbd-capplet
gksu glib-networking glib-networking-common glib-networking-services gnome-accessibility-themes gnome-applets gnome-applets-data gnome-backgrounds gnome-bluetooth gnome-contacts
gnome-control-center gnome-control-center-data gnome-core gnome-desktop3-data gnome-dictionary gnome-disk-utility gnome-font-viewer gnome-keyring gnome-menus gnome-online-accounts
gnome-packagekit gnome-panel gnome-panel-data gnome-power-manager gnome-screensaver gnome-screenshot gnome-session gnome-session-bin gnome-session-common gnome-session-fallback
gnome-settings-daemon gnome-shell gnome-shell-common gnome-sushi gnome-system-log gnome-system-monitor gnome-terminal gnome-terminal-data gnome-themes-standard
gnome-themes-standard-data gnome-user-share gsettings-desktop-schemas gstreamer0.10-plugins-bad gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly
gstreamer0.10-pulseaudio gstreamer0.10-x gtk2-engines gucharmap gvfs gvfs-backends gvfs-bin gvfs-common gvfs-daemons gvfs-libs initscripts iproute iptables iputils-ping
isc-dhcp-client isc-dhcp-common libaacs0 libaccountsservice0 libapache2-mod-dnssd libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg4.12 libasound2 libasound2-plugins
libatasmart4 libatk-adaptor libatk-bridge2.0-0 libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatkmm-1.6-1 libatspi2.0-0 libavahi-gobject0 libavahi-ui-gtk3-0 libbind9-80
libblas3 libbluetooth3 libbrasero-media3-1 libcairo2 libcanberra-gtk-module libcanberra-gtk0 libcanberra-gtk3-0 libcanberra-gtk3-module libcaribou-common libcaribou-gtk-module
libcaribou-gtk3-module libcaribou0 libchamplain-0.12-0 libchamplain-gtk-0.12-0 libck-connector0 libclutter-1.0-0 libclutter-gst-1.0-0 libclutter-gtk-1.0-0 libclutter-imcontext-0.1-0
libclutter-imcontext-0.1-bin libcluttergesture-0.0.2-0 libcryptsetup4 libcups2 libcupsimage2 libcurl3 libcurl3-gnutls libcwidget3 libdbd-mysql-perl libdbi-perl
libdevmapper-event1.02.1 libdevmapper1.02.1 libdirac-encoder0 libdjvulibre21 libdns88 libenchant1c2a libept1.4.12 libevdocument3-4 libevview3-3 libexempi3 libfarstream-0.1-0
libfftw3-3 libfolks-eds25 libfolks-telepathy25 libfolks25 libfontconfig1 libgail-3-0 libgail-common libgail18 libgcc1 libgck-1-0 libgconf-2-4 libgconf2-4 libgcr-3-1 libgdict-1.0-6
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgeoclue0 libgeocode-glib0 libgfortran3 libgirepository-1.0-1 libgksu2-0 libgl1-mesa-dri libgl1-mesa-glx libglade2-0 libglapi-mesa
libglib2.0-0 libglib2.0-bin libglibmm-2.4-1c2a libgmime-2.6-0 libgnome-keyring-common libgnome-keyring0 libgnome-menu-3-0 libgoa-1.0-common libgomp1 libgpgme11 libgs9 libgs9-common
libgssdp-1.0-3 libgstreamer-plugins-bad0.10-0 libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgtk2.0-0 libgtk2.0-bin libgtkmm-3.0-1
libgtksourceview-3.0-common libgucharmap-2-90-7 libgudev-1.0-0 libgupnp-1.0-4 libgxps2 libhtml-parser-perl libhttp-message-perl libio-socket-ssl-perl libisc84 libisccfg82 libitm1
libjasper1 libjavascriptcoregtk-3.0-0 libjson-glib-1.0-0 libjson0 libldap-2.4-2 liblocale-gettext-perl liblvm2app2.2 liblwres80 libmailtools-perl libmission-control-plugins0
libmozjs185-1.0 libmx-1.0-2 libmx-common libnautilus-extension1a libneon27-gnutls libnet-dbus-perl libnet-ssleay-perl libnetfilter-conntrack3 libnice10 libnm-glib4 libnm-gtk-common
libnm-gtk0 libnm-util2 libnotify4 libofa0 libp11-kit0 libpam-ck-connector libpam-modules libpam-modules-bin libpam0g libpanel-applet-4-0 libpango1.0-0 libpangomm-1.4-1 libpaper1
libpeas-1.0-0 libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler-glib8 libpulse-mainloop-glib0 libpulse0 libpurple0 libpython2.7 libquadmath0 libquvi7
librdf0 librest-0.7-0 librest-extras-0.7-0 librsvg2-2 librsvg2-common libsane libsane-common libsasl2-2 libsemanage-common libsemanage1 libsmbclient libsnmp-base libsocket-perl
libsoup-gnome2.4-1 libsoup2.4-1 libspandsp2 libssh2-1 libstdc++6 libtag1-vanilla libtag1c2a libtelepathy-glib0 libterm-readkey-perl libtext-charwidth-perl libtext-iconv-perl
libusb-1.0-0 libuuid-perl libv4l-0 libv4lconvert0 libva1 libvte-2.90-9 libvte-2.90-common libwebkitgtk-3.0-0 libwnck-3-0 libxapian22 libxft2 libxml-parser-perl libxslt1.1 libyelp0
libzbar0 lighttpd linux-headers-amd64 linux-image-amd64 login menu mesa-utils metacity metacity-common modemmanager mount mousetweaks mutter-common nautilus nautilus-data
network-manager network-manager-gnome notification-daemon ntfs-3g obex-data-server openssh-client openssh-server packagekit packagekit-tools passwd perl perl-base perl-modules
php-pear php5-cgi php5-cli php5-common php5-curl php5-gd php5-imagick php5-imap php5-intl php5-mcrypt php5-memcache php5-mysql php5-pspell php5-recode php5-snmp php5-sqlite
php5-tidy php5-xdebug php5-xmlrpc php5-xsl phpmyadmin pidgin-data pm-utils policykit-1 ppp procps pslib1 pulseaudio pulseaudio-module-x11 pulseaudio-utils python python-apt
python-chardet python-debian python-gi python-glade2 python-gobject python-gobject-2 python-gtk2 python-minimal python-notify python-pyatspi python-pyatspi2 python-reportbug
python-soappy python-xapian python2.7 python2.7-minimal reportbug rsyslog sane-utils shared-mime-info ssh sudo sysv-rc sysvinit sysvinit-utils telepathy-gabble telepathy-haze
telepathy-logger telepathy-mission-control-5 telepathy-salut tracker tracker-extract tracker-gui tracker-miner-fs tracker-utils ttf-dejavu ttf-dejavu-core ttf-dejavu-extra udev
udisks upower usb-modeswitch usb-modeswitch-data usbmuxd util-linux vino vsftpd wget x11-utils xorg xserver-xephyr xserver-xorg xserver-xorg-core xserver-xorg-input-evdev
xserver-xorg-input-mouse xserver-xorg-input-synaptics xserver-xorg-input-vmmouse xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-ati xserver-xorg-video-cirrus
xserver-xorg-video-fbdev xserver-xorg-video-intel xserver-xorg-video-mach64 xserver-xorg-video-mga xserver-xorg-video-neomagic xserver-xorg-video-nouveau
xserver-xorg-video-openchrome xserver-xorg-video-r128 xserver-xorg-video-radeon xserver-xorg-video-savage xserver-xorg-video-siliconmotion xserver-xorg-video-sisusb
xserver-xorg-video-tdfx xserver-xorg-video-trident xserver-xorg-video-vesa xserver-xorg-video-vmware yelp zenity zenity-common
0 upgraded, 0 newly installed, 0 to remove and 503 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian7:/var/www# python-numpy --configure
bash: python-numpy: command not found
root@debian7:/var/www# dpkg-reconfigure python-numpy
/usr/sbin/dpkg-reconfigure: python-numpy is broken or not fully installed
root@debian7:/var/www# apt-get -f install;
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
folks-common libgnome-media-profiles-3.0-0 libmozjs17d libreadline5 libts-0.0-0 tsconf xulrunner-17.0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 503 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian7:/var/www# aptitude install python-numpy
The following packages will be REMOVED:
folks-common{u} libgnome-media-profiles-3.0-0{u} libmozjs17d{u} libreadline5{u} libts-0.0-0{u} tsconf{u} xulrunner-17.0{u}
The following partially installed packages will be configured:
python-numpy
0 packages upgraded, 0 newly installed, 7 to remove and 503 not upgraded.
Need to get 0 B of archives. After unpacking 35.9 MB will be freed.
Do you want to continue? [Y/n/?] Y
(Reading database ... 107860 files and directories currently installed.)
Removing folks-common ...
Removing libgnome-media-profiles-3.0-0 ...
Removing xulrunner-17.0 ...
Removing libmozjs17d ...
Removing libreadline5:amd64 ...
Removing libts-0.0-0:amd64 ...
Removing tsconf ...
Processing triggers for libglib2.0-0:amd64 ...
No such key `picture-options' in schema `org.gnome.desktop.screensaver' as specified in override file `/usr/share/glib-2.0/schemas/10_desktop-base.gschema.override'; ignoring override for this key.
No such key `picture-uri'
in schema `org.gnome.desktop.screensaver' as specified in override file `/usr/share/glib-2.0/schemas/10_desktop-base.gschema.override'; ignoring override for this key.
Processing triggers for gconf2 ...
Processing triggers for libc-bin ...
Processing triggers for man-db ...
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy

Current status: 43139 new [-2].
root@debian7:/var/www# apt-get -f install;
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 503 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian7:/var/www# aptitude install python-numpy
The following partially installed packages will be configured:
python-numpy
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 503 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
dpkg: dependency problems prevent configuration of python-numpy:
python-numpy depends on python2.7:any.

dpkg: error processing python-numpy (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-numpy

root@debian7:/var/www# aptitude install python2.7

The following NEW packages will be installed:
libdb5.3{a} libffi6{a} libpython2.7-minimal{a} libpython2.7-stdlib{a}
The following packages will be upgraded:
python2.7 python2.7-minimal
The following partially installed packages will be configured:
python-numpy
2 packages upgraded, 4 newly installed, 0 to remove and 501 not upgraded.
Need to get 4,573 kB of archives. After unpacking 2,545 kB will be used.
The following packages have unmet dependencies:
libpython2.7 : Depends: python2.7 (= 2.7.3-6) but 2.7.9-2 is to be installed.
The following actions will resolve these dependencies:

Remove the following packages:
1) eog
2) gir1.2-peas-1.0
3) gnome-core
4) libpeas-1.0-0
5) libpython2.7

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

Upgrade the following packages:
1) libpython2.7 [2.7.3-6 (now) -> 2.7.9-2 (stable)]

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