Score:0

Getting errors with apt update

cn flag

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?

cocomac avatar
cn flag
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](https://askubuntu.com/questions/384033/removed-python-3-and-now-ubuntu-software-center-terminal-and-other-applications) for one other example of this. Side note: We probobly need a canonical question for "I messed with Python and broke my system".
waltinator avatar
it flag
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.
Grumpy ol' Bear avatar
cn flag
That's shite. I need python3.10 for some specific functions...what do?
Grumpy ol' Bear avatar
cn flag
Oh well, I guess it's time for `timeshift --restore` to shine...
cocomac avatar
cn flag
Use Docker. Or a virtual Python environment. And keep backups, too.
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.