Score:2

/usr/lib/cnf-update-db: ModuleNotFoundError: No module named 'CommandNotFound' when doing "sudo apt update"

mm flag

whenever I try to run sudo apt update or sudo apt-get update, I keep getting the following error:

Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
ImportError: No module named 'CommandNotFound'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
[1]    120555 exit 100   sudo apt update

I'm on Kubuntu 20.04 and my Python version is 2.5.2. I have compiled Python 3.6, 3.7 and 3.8 and tried, but still the same issue.

When I try to install python3-apt (as given in some similar questions), I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-apt is already the newest version (2.0.0ubuntu0.20.04.5).
python3-apt set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 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] 
Setting up python3-setuptools (45.2.0-1) ...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-setuptools (--configure):
 installed python3-setuptools package post-installation script subprocess returned error exit status 3
Setting up python3-wheel (0.34.2-1) ...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-wheel (--configure):
 installed python3-wheel package post-installation script subprocess returned error exit status 3
Errors were encountered while processing:
 python3-setuptools
 python3-wheel
E: Sub-process /usr/bin/dpkg returned an error code (1)
[1]    120974 exit 100   sudo apt install python3-apt

Any help would be greatly appreciated!

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.