Score:-1

module 'collections' has no attribute 'Mapping' how to safely reinstall update-notifier-common?

in flag

When running app upgrade I get the following errors:

$ sudo sudo apt upgrade
[sudo] password for admin-federico-dostuni:
Hit:1 http://azure.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://azure.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease
Hit:6 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Fetched 172 kB in 1s (176 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
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.
1 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 (3.192.1.15) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
    import debian.deb822
  File "/usr/lib/python3/dist-packages/Debian/deb822.py", line 78, in <module>
    class TagSectionWrapper(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
dpkg: error processing package update-notifier-common (--configure):
 installed update-notifier-common package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 update-notifier-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

Looking online it looks like that the issue is caused by a missing collections.Mapping attribute in the debian.deb822 module. To resolve the issue I should:

  1. List item

Remove the package update-notifier-common

sudo dpkg --remove --force-remove-reinstreq update-notifier-common
  1. Update apt, and reinstall update-notifier-common
sudo apt-get install update-notifier-common

The problem is that I can't pass the 1st step because I got this error message:

sudo dpkg --remove --force-remove-reinstreq update-notifier-common
dpkg: dependency problems prevent removal of update-notifier-common:
 ubuntu-server depends on update-notifier-common.

dpkg: error processing package update-notifier-common (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 update-notifier-common

I checked update-notifier-common dependencies and it doesn't look good:

$ apt-cache rdepends update-notifier-common
update-notifier-common
Reverse Depends:
  update-notifier
  flashplugin-installer
  ubuntu-server
  debconf
  ttf-mscorefonts-installer
  apt-config-auto-update
  reboot-notifier
  apt-config-auto-update
  update-notifier
  debconf
  ubuntu-server
  byobu

How can I safely remove update-notifier-common without messing up the whole OS?

hr flag
Did you manually install a different python3 version?
Artur Meinild avatar
vn flag
Possibly related? https://stackoverflow.com/questions/70195545/module-collections-has-no-attribute-mapping-issue-on-macos-for-sdk-installa
in flag
@steeldriver yes, I have manually installed Python 3.10.9 and now my OS have 3 python version, however I configured `update-alternatives` and set python 3.10.9 as default version.
Score:1
in flag

Apparently, the issue isn't update-notifier-common but the python version I have on this machine.

karel avatar
sa flag
That's obviously true, so all you need to do is to reconfigure update-alternatives to use the original Python version as the default version.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.