I'm not very experienced with Ubuntu and when I started playing around with Python a year I assume I overwrote some important dependencies.
I made it even worse by trying to fix the issues and now I can't install or use nodejs which is essential for my work.
When I run sudo apt update
I get the following error
Get:34 http://nl.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.768 B]
Fetched 6.700 kB in 5s (1.312 kB/s)
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 11, 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
When I run sudo apt --fix-broken install
I get the following error
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is installed
Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is installed
Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is installed
python3-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-gi : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.56.1-1 is installed
python3-gi-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-markupsafe : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-netifaces : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-protobuf : Depends: libprotobuf17 but it is not installed
Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-reportlab-accel : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-sip : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
python3-zope.interface : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
Before it got to this state I saw that I had around 1600 outdated packages. I realize this isn't an easy issue to fix but any help would be greatly appreciated.
When trying to install aptitude
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.12-1ubuntu4) but it is not going to be installed
Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not going to be installed
Depends: libboost-iostreams1.71.0 but it is not going to be installed
Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
Depends: libncursesw6 (>= 6.1+20180210) but it is not going to be installed
Depends: libxapian30 (>= 1.4.14~) but 1.4.5-1ubuntu0.1 is to be installed
gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is to be installed
Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is to be installed
Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is to be installed
python3-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-gi : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.56.1-1 is to be installed
python3-gi-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-markupsafe : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-netifaces : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-protobuf : Depends: libprotobuf17 but it is not going to be installed
Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-reportlab-accel : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-sip : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
python3-zope.interface : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).