0

When I do apt update I get:

Hit:1 http://archive.ubuntu.com/ubuntu impish InRelease
Hit:2 https://download.docker.com/linux/ubuntu hirsute InRelease
Hit:3 http://archive.ubuntu.com/ubuntu impish-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu impish-backports InRelease
Hit:5 http://security.ubuntu.com/ubuntu impish-security InRelease
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
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

all I did was https://cloudbytes.dev/snippets/upgrade-python-to-latest-version-on-ubuntu-linux, how can I fix this?

  • 3
    At the end of that article, there is a section titled "[OPTIONAL] Fix Python3-apt". I suggest you read that. Disclaimer: I don't know if that will work, and it may make it worse if it doesn't fix it. Moreover, messing with Python versions in Ubuntu tends to break stuff. See this question for one other example of this. Side note: We probobly need a canonical question for "I messed with Python and broke my system". – cocomac Feb 23 '22 at 21:57
  • 4
    Ask https://cloudbytes.dev/snippets/upgrade-python-to-latest-version-on-ubuntu-linux They might have a clue. You have followed somebody else's root path, without understanding. This is a Well Known Bad Idea. – waltinator Feb 23 '22 at 21:58
  • That's shite. I need python3.10 for some specific functions...what do? – Grumpy ol' Bear Feb 23 '22 at 22:00
  • Oh well, I guess it's time for timeshift --restore to shine... – Grumpy ol' Bear Feb 23 '22 at 22:15
  • 1
    Use Docker. Or a virtual Python environment. And keep backups, too. – cocomac Feb 23 '22 at 23:11

0 Answers0