command line – apt error % terminal not opening ubuntu 20.0.4


The terminal is not opening normally i have to click on file browser and then right click and open terminal here and when it does open from here and sudo apt update it shows the following error sudo apt update

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://ly.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://ly.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://ly.archive.ubuntu.com/ubuntu focal-backports InRelease
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
ModuleNotFoundError: 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