32

sys.path:

['/usr/lib/update-notifier', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux3', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages']
terry@terrylaptop:/usr/lib$ sudo apt-get install python-debian
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-debian is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 239 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up update-notifier-common (0.119ubuntu8.6) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 26, in <module>
    import debian.deb822
ImportError: No module named debian.deb822
dpkg: error processing update-notifier-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of flashplugin-installer:
 flashplugin-installer depends on update-notifier-common (>= 0.119ubuntu2); however:
  Package update-notifier-common is not configured yet.
dpkg: error processing flashplugin-installer (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
   Errors were encountered while processing:
 update-notifier-common
 flashplugin-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)

This problem occurs everytime when I try to use apt-get install to update my Ubuntu. I am on 12.04.01 LTS.

I also installed python-debian from this link: http://pkgs.org/ubuntu-12.04/ubuntu-main-i386/python-debian_0.1.21ubuntu1_all.deb.html But it doesn't work.

Can somebody help me? Thank you very much. I googled but seems this should be already fixed in old version.

terry@terrylaptop:/usr/lib$ sudo apt-get install dolphin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
dolphin is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 239 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up update-notifier-common (0.119ubuntu8.6) ...
['/usr/lib/update-notifier', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-linux3', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages']
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 29, in <module>
    import debian.deb822
ImportError: No module named debian.deb822
dpkg: error processing update-notifier-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of flashplugin-installer:
 flashplugin-installer depends on update-notifier-common (>= 0.119ubuntu2); however:
  Package update-notifier-common is not configured yet.
dpkg: error processing flashplugin-installer (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error   from a previous failure.
                                                                                                          Errors were encountered while processing:
 update-notifier-common
 flashplugin-installer
E: Sub-process /usr/bin/dpkg returned an error code (1)
terry@terrylaptop:/usr/lib$ ls /usr/local/lib/python2.6/debian.deb822.py 
/usr/local/lib/python2.6/debian.deb822.py

terry@terrylaptop:/usr/lib$ cat /usr/local/lib/python2.6/debian.deb822.py
import warnings

warnings.warn("please use 'debian.deb822' instead", DeprecationWarning,
              stacklevel=2)

from debian.deb822 import *

You can see that debian.deb822 in /usr/local/lib/python2.6, but still cannot find it.

------latest update on 2/20----------------

terry@terrylaptop:/usr/local/bin$ ls -l /usr/bin/py*
-rwxr-xr-x 1 root root  3752 May  2  2012 /usr/bin/py3_compilefiles
-rwxr-xr-x 1 root root 97759 May  2  2012 /usr/bin/pycentral
-rwxr-xr-x 1 root root  4124 Apr 18  2012 /usr/bin/pyclean
-rwxr-xr-x 1 root root 11933 Apr 18  2012 /usr/bin/pycompile
-rwxr-xr-x 1 root root  3723 May  2  2012 /usr/bin/py_compilefiles
lrwxrwxrwx 1 root root     8 Apr 27  2012 /usr/bin/pydoc -> pydoc2.7
-rwxr-xr-x 1 root root    79 Aug  1  2012 /usr/bin/pydoc2.7
lrwxrwxrwx 1 root root    12 Apr 27  2012 /usr/bin/pygettext -> pygettext2.7
-rwxr-xr-x 1 root root 22103 Aug  1  2012 /usr/bin/pygettext2.7
-rwxr-xr-x 1 root root   217 Mar  9  2012 /usr/bin/pyhtmlizer
lrwxrwxrwx 1 root root    24 Feb 20 07:24 /usr/bin/python -> /usr/loca/bin/python2.7
lrwxrwxrwx 1 root root    24 Jun 14  2012 /usr/bin/python2 -> /usr/local/bin/python2.6
lrwxrwxrwx 1 root root    24 Jun 14  2012 /usr/bin/python2.6 -> /usr/local/bin/python2.6
lrwxrwxrwx 1 root root    29 Apr 27  2012 /usr/bin/pyversions -> ../share/python/pyversions.py

terry@terrylaptop:/usr/local/bin$ ls -l /usr/local/bin/py*
-rwxrwxr-x 1 root root      84 Feb 20 07:21 /usr/local/bin/pydoc
lrwxrwxrwx 1 root root      24 Feb 20 07:31 /usr/local/bin/python -> /usr/local/bin/python2.7
lrwxrwxrwx 1 root root       9 Feb 20 07:23 /usr/local/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 4610075 Jun 14  2012 /usr/local/bin/python2.6
-rwxr-xr-x 1 root root    1424 Jun 14  2012 /usr/local/bin/python2.6-config
-rwxr-xr-x 1 root root 4917197 Feb 20 07:22 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root    1624 Feb 20 07:23 /usr/local/bin/python2.7-config
lrwxrwxrwx 1 root root      16 Feb 20 07:23 /usr/local/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root      14 Feb 20 07:23 /usr/local/bin/python-config -> python2-config

I still cannot install. The sys.path is:

['/usr/lib/update-notifier', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']

------2013/2/22 update ---------------

terry@terrylaptop:/data$ sudo apt-get install python2.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python2.7 is already the newest version.
The following packages were automatically installed and are no longer required:
  libnepomukdatamanagement4 libkexiv2-10 libkdegames5a libboost-program-options1.46.1 libkdecorations4 libkwinglutils1 libnepomuksync4  libokularcore1abi1 libssl0.9.8 libattica0.3 liblastfm0 libkwineffects1abi3
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
18
  • Why do you have this: "0 upgraded, 0 newly installed, 0 to remove and 239 not upgraded."?
    – user25656
    Jan 24, 2013 at 10:17
  • @vasa1, Because it is already installed, or because the package manager is broken. Ahh look a few lines more and we see the package manager is broken. We are not going to be able to fix the package manager my upgrading it via the package manager. We will have to download a fix and patch it manually. Jan 24, 2013 at 10:23
  • does it do same when installing non debian packages? If so can you update the question, to make it more generic. (You may get more answers). Jan 24, 2013 at 10:29
  • We have exactly the same problem on a server that we upgraded from 9.10 -> 10.04 and now to 12.04 and got this problem. I didnt do the upgrade so I dont know where it broke, it should be easy fix it manually since its just a python module thats missing (A reference 12.04 system has "/usr/lib/python2.7/dist-packages/debian" which contains links to various modules in "/usr/share/pyshared", deb822 among others while on the broken system the debian folder is abscent.
    – Ernelli
    Jan 24, 2013 at 14:45
  • Hi, I've added more debug information to better:
    – Terry
    Jan 25, 2013 at 3:37

13 Answers 13

27

Try reinstalling the package which is supposed to contain debian.deb822:

sudo apt-get --reinstall install python-debian
1
  • 6
    With recent Ubuntu version: sudo apt-get --reinstall install python3-debian
    – Natim
    Dec 19, 2021 at 9:56
22

In my case I had to uninstall all conflicting packages like update-notifier, update-notifier-common, etc and then I ran:

sudo apt install --reinstall python-debian python3-debian python-chardet python3-chardet
2
  • 2
    This was the only solution that worked for me after trying all the others (and including this: askubuntu.com/questions/812375/…)
    – slhck
    Mar 27, 2017 at 8:18
  • This answer worked for me as well. I started getting this error shortly after I installed python3...update-notifier picked up the existence of python3, but couldn't complete because it was missing the necessary dependencies. I had to run sudo apt install python3-debian python3-chardet python3-six and all is well.
    – Joe
    May 24, 2017 at 12:29
13

I use apt-get remove command to remove the update-notifier-common, flashplugin-installer then the problem workaround.

Here is the command:

sudo apt-get remove  update-notifier-common flashplugin-installer
2
  • yes but this is more like a workaround, and then you don't have flash updated neither you have the update notifier anymore
    – Huafu
    Dec 10, 2014 at 22:01
  • very well done. This is still working. Jul 13, 2018 at 5:54
6

I had both python 2.6 and 2.7 installed so I needed to switch back to 2.7 which had debian.deb822

sudo update-alternatives --config python
1
  • this worked for me too, and I am on 14.04
    – Huafu
    Dec 10, 2014 at 22:01
4

You probably removed python debian package run these commands to reinstall python-debian and after that install update-notifier package.

sudo apt-get remove  update-notifier-common
sudo apt-get autoremove
sudo apt-get --reinstall install python-debian
sudo apt-get install  update-notifier
4

My solution

apt-get --reinstall install python-chardet

Anatomy of the issue

on my platform dpkg -L python-chardet claimed that python-chardet would be using these files:

# dpkg -L python-chardet
/.
/usr
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/chardet.1.gz
/usr/share/doc
/usr/share/doc/python-chardet
/usr/share/doc/python-chardet/history.html
/usr/share/doc/python-chardet/css
/usr/share/doc/python-chardet/css/chardet.css
/usr/share/doc/python-chardet/faq.html
/usr/share/doc/python-chardet/images
/usr/share/doc/python-chardet/images/tip.png
/usr/share/doc/python-chardet/images/note.png
/usr/share/doc/python-chardet/images/permalink.gif
/usr/share/doc/python-chardet/images/warning.png
/usr/share/doc/python-chardet/images/caution.png
/usr/share/doc/python-chardet/images/important.png
/usr/share/doc/python-chardet/index.html
/usr/share/doc/python-chardet/how-it-works.html
/usr/share/doc/python-chardet/usage.html
/usr/share/doc/python-chardet/license.html
/usr/share/doc/python-chardet/changelog.Debian.gz
/usr/share/doc/python-chardet/copyright
/usr/share/doc/python-chardet/supported-encodings.html
/usr/bin
/usr/bin/chardet
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/chardet
/usr/lib/python2.7/dist-packages/chardet/langcyrillicmodel.py
/usr/lib/python2.7/dist-packages/chardet/mbcharsetprober.py
/usr/lib/python2.7/dist-packages/chardet/test.py
/usr/lib/python2.7/dist-packages/chardet/charsetgroupprober.py
/usr/lib/python2.7/dist-packages/chardet/utf8prober.py
/usr/lib/python2.7/dist-packages/chardet/langgreekmodel.py
/usr/lib/python2.7/dist-packages/chardet/hebrewprober.py
/usr/lib/python2.7/dist-packages/chardet/langhebrewmodel.py
/usr/lib/python2.7/dist-packages/chardet/escprober.py
/usr/lib/python2.7/dist-packages/chardet/mbcssm.py
/usr/lib/python2.7/dist-packages/chardet/jpcntx.py
/usr/lib/python2.7/dist-packages/chardet/codingstatemachine.py
/usr/lib/python2.7/dist-packages/chardet/gb2312prober.py
/usr/lib/python2.7/dist-packages/chardet/latin1prober.py
/usr/lib/python2.7/dist-packages/chardet/euctwprober.py
/usr/lib/python2.7/dist-packages/chardet/escsm.py
/usr/lib/python2.7/dist-packages/chardet/universaldetector.py
/usr/lib/python2.7/dist-packages/chardet/langbulgarianmodel.py
/usr/lib/python2.7/dist-packages/chardet/gb2312freq.py
/usr/lib/python2.7/dist-packages/chardet/langthaimodel.py
/usr/lib/python2.7/dist-packages/chardet/constants.py
/usr/lib/python2.7/dist-packages/chardet/eucjpprober.py
/usr/lib/python2.7/dist-packages/chardet/euctwfreq.py
/usr/lib/python2.7/dist-packages/chardet/jisfreq.py
/usr/lib/python2.7/dist-packages/chardet/sbcharsetprober.py
/usr/lib/python2.7/dist-packages/chardet/mbcsgroupprober.py
/usr/lib/python2.7/dist-packages/chardet/__init__.py
/usr/lib/python2.7/dist-packages/chardet/sjisprober.py
/usr/lib/python2.7/dist-packages/chardet/euckrprober.py
/usr/lib/python2.7/dist-packages/chardet/langhungarianmodel.py
/usr/lib/python2.7/dist-packages/chardet/charsetprober.py
/usr/lib/python2.7/dist-packages/chardet/chardistribution.py
/usr/lib/python2.7/dist-packages/chardet/sbcsgroupprober.py
/usr/lib/python2.7/dist-packages/chardet/big5freq.py
/usr/lib/python2.7/dist-packages/chardet/big5prober.py
/usr/lib/python2.7/dist-packages/chardet/euckrfreq.py
/usr/lib/python2.7/dist-packages/chardet-2.0.1.egg-info

but the problem is that none of these were existing:

# ls /usr/lib/python2.7/dist-packages/chardet
ls: cannot access /usr/lib/python2.7/dist-packages/chardet: No such file or directory

Another test you can do

you can also check chardet by using the binary:

/usr/bin/chardet

If it outputs something like this, the lib is broken:

# /usr/bin/chardet 
Traceback (most recent call last):
  File "/usr/bin/chardet", line 26, in <module>
    import chardet
ImportError: No module named chardet

My original error message:

root@odroid:/etc/nagios# apt-get install  update-notifier             
Reading package lists... Done Building dependency tree        Reading
state information... Done update-notifier is already the newest
version. 0 upgraded, 0 newly installed, 0 to remove and 5 not
upgraded. 4 not fully installed or removed. After this operation, 0 B
of additional disk space will be used. Do you want to continue? [Y/n] 
Setting up update-notifier-common (0.154.1ubuntu1) ... Traceback (most
recent call last):   File
"/usr/lib/update-notifier/package-data-downloader", line 26, in
<module>
    import debian.deb822   File "/usr/lib/python2.7/dist-packages/debian/deb822.py", line 39
    import chardet
         ^ SyntaxError: invalid syntax dpkg: error processing package update-notifier-common (--configure):  subprocess installed
post-installation script returned error exit status 1 dpkg: dependency
problems prevent configuration of update-notifier:  update-notifier
depends on update-notifier-common (= 0.154.1ubuntu1); however:  
Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure): 
dependency problems - leaving unconfigured dpkg: dependency problems
prevent configuration of update-manager:  update-manager depends on
update-notifier; however:   Package update-notifier is not configured
yet.

dpkg: error processing package update-manager (--configure): 
dependency problems - leaving unconfigured dpkg: dependency problems
prevent configuration of ubuntu-release-upgrader-gtk: 
ubuntu-release-upgrader-gtk depends on update-manager; however:  
Package update-manager is not configured yet.

dpkg: error processing package ubuntu-release-upgrader-gtk
(--configure):  depenNo apport report written because the error
message indicates its a followup error from a previous failure.
                                                                                                                No apport report written because the error message indicates its a
followup error from a previous failure.
                                                                   No apport report written because MaxReports is reached already
                                                                                                                                 dency problems - leaving unconfigured Errors were encountered while
processing:  update-notifier-common  update-notifier  update-manager 
ubuntu-release-upgrader-gtk E: Sub-process /usr/bin/dpkg returned an
error code (1)

so as i said above, just reinstall chardet:

apt-get --reinstall install python-chardet
1
  • i actually don't like Volker Siegel's edit. i'm using lower case intentionally.
    – qknight
    Jan 21, 2015 at 0:10
4

In my case what fixed it on ubuntu 16.04 (the problem still bites many years since the original post) is to fix the python symlinks:

cd /usr/bin
sudo ln -sf python3.6 python3
sudo ln -sf python3 python

So now I have:

/usr/bin# ls -l python python3
lrwxrwxrwx 1 root root 7 Jun 29 15:33 python -> python3
lrwxrwxrwx 1 root root 9 Jun 29 15:38 python3 -> python3.6

Previously python3 was pointing to python3.5. Once I re-linked it to python3.6 apt worked again.

At the moment I have python 2.7, 3.5 and 3.6 installed side-by-side.

1
  • Solved it for me. I had the problem after installing python3.7 which had python3 point to python3.7 instead of python3.6
    – Emonadeo
    Mar 20, 2019 at 16:58
4

I just had this error after upgrading to Ubuntu 18.04 from 16.10, but mine was a little more tricky. The packages listed as causing the error included ubuntu-desktop, which I obviously could not remove and then reinstall. So I could not do the top recommended solution. I had to combine 2 solutions above. First I did this:

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get upgrade

as hchen96 recommended. This cleared up failures with apt commands.

Then I called

sudo apt install --reinstall python-debian python3-debian python-chardet python3-chardet

as marcosfede recommended.

Then finally, don't forget to fix dpkg

sudo cp -nr /var/lib/dpkg/info.bak /var/lib/dpkg/info
2

For me it was solved by installing the python-debian package for python3:

sudo apt install python3-debian
1
  • If you have the package and it is broken: sudo apt install --reinstall python3-debian
    – sage
    Mar 2, 2023 at 20:42
2

I encountered the same problem today. After a number of searches on the Stack Overflow site, no desired solution was found. However, I found a solution after searching on a Chinese website, and below are the solution:

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get upgrade

Ref here

2

This is the error I receive:

File "/usr/bin/debtags", line 32, in
from debian import deb822
ModuleNotFoundError: No module named 'debian'

And this is how I fixed it.

sudo apt-get --reinstall install python3-debian 
apt update && apt upgrade -y && apt dist-upgrade
2

Removing python3-debian:

sudo apt-get purge python3-debian

and install it again:

sudo apt-get install python3-debian 

worked for me.

1

I was run onto this error:

Traceback (most recent call last):
File "/usr/bin/debtags", line 32, in
from debian import deb822
ModuleNotFoundError: No module named 'debian'

Here's how you can fix it:

apt --fix-broken install

If the above doesn't fix the issue, try this, but keep in mind that in both situations, you have to run this also:

sudo apt-get --reinstall install python3-debian 
apt update && apt upgrade -y && apt dist-upgrade

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .