So I am new to Ubuntu and I am currently busy installing python packages for a project. When I tried to run 'sudo get-apt upgrade', the following dpkg:error popped up.

I have tried a lot of commands to try and fix this problem.

This is what I have tried so far:

sudo apt-get autoremove
sudo apt-get --purge remove && sudo apt-get autoclean
sudo apt-get -f install
sudo apt-get update
sudo apt-get upgrade && sudo apt-get dist-upgrade
sudo dpkg-reconfigure -a
sudo dpkg --configure -a
for pkg in `dpkg --get-selections | egrep -v 'deinstall' | egrep 
python | awk '{print $1}'`; do  apt-get -y --force-yes install --
reinstall $pkg ; done <- This command just created more errors.

Any advice on how I can possibly fix this error? Thanks.

This is the terminal output when I ran the following command:

~$ sudo apt-get upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
12 not fully installed or removed.
Need to get 0 B/2,905 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package python-pil:amd64 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
No apport report written because the error message indicates its a 
previous failure.


Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I did ran a audit command and got the following:

~$ sudo dpkg --audit 
The following packages are in a mess due to serious problems during
installation.  They must be reinstalled for them (and any packages
that depend on them) to function properly:
ipython              enhanced interactive Python shell
ipython-notebook     interactive Python html notebook
libboost-mpi-python1.58.0 C++ interface to the Message Passing    Interface (MPI)
libboost-python1.58-dev Boost.Python Library development files
python-antlr         language tool for constructing recognizers,    compilers etc
python-bs4           error-tolerant HTML parser for Python
python-cairo         Python bindings for the Cairo vector graphics    library
python-chardet       universal character encoding detector for Python2
python-cvxopt        Python package for convex optimization
python-pil:amd64     Python Imaging Library (Pillow fork)

The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
asymptote            script-based vector graphics language inspired by       MetaPos

The following packages are only half configured, probably due to problems
configuring them the first time.  The configuration should be retried    using
dpkg --configure <package> or the configure menu option in dselect:
python-jinja2        small but fast and easy to use stand-alone    template engin
python-markupsafe    HTML/XHTML/XML string library for Python
python-pil.imagetk:amd64 Python Imaging Library - ImageTk Module    (Pillow fork)

Your Answer

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

Browse other questions tagged or ask your own question.