Cannot run, install, update, or uninstall python3 from ubuntu 24.04
https://askubuntu.com/questions/1564673/cannot-run-install-update-or-uninstall-python3-from-ubuntu-24-04I'm currently trying to install python3 onto ubuntu24.04.3. I only realized that python came preinstalled with ubuntu after attempting sudo apt install python3.
I have now seemed to have permanently borked python and apt on my system. When I try to run any python operation, the system cannot find the python3command. When I try to run sudo apt install python3, I get the following output:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3 : Depends: libpython3-stdlib (= 3.12.3-0ubuntu2.1) but 3.12.3-0ubuntu2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I tried to run sudo apt install libpython3-stdliband got the following output:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3 : PreDepends: python3-minimal (= 3.12.3-0ubuntu2) but 3.12.3-0ubuntu2.1 is to be installed
Depends: libpython3-stdlib (= 3.12.3-0ubuntu2) but 3.12.3-0ubuntu2.1 is to be installed
python3-dev : Depends: python3 (= 3.12.3-0ubuntu2.1) but 3.12.3-0ubuntu2 is to be installed
python3-venv : Depends: python3 (= 3.12.3-0ubuntu2.1) but 3.12.3-0ubuntu2 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
I thought that there might have been an issue with my apt repos, so I ran a sudo apt update. It resulted in this error:
Hit:6 http://archive.ubuntu.com/ubuntu noble-backports InRelease
Fetched 6,581 B in 1s (11.3 kB/s)
sh: 1: /usr/lib/cnf-update-db: Permission denied
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
Getting pretty frustrated at this point, I decided I'd try to run --fix-broken as it suggested.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
libllvm19
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
libpython3-stdlib python3
Suggested packages:
python3-doc python3-tk
The following packages will be upgraded:
libpython3-stdlib python3
2 upgraded, 0 newly installed, 0 to remove and 347 not upgraded.
3 not fully installed or removed.
Need to get 0 B/33.1 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up python3-minimal (3.12.3-0ubuntu2.1) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: py3compile: Permission denied
dpkg: error processing package python3-minimal (--configure):
installed python3-minimal package post-installation script subprocess returned error exit status 126
Errors were encountered while processing:
python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
I'm completely stuck at this point. And I'd much rather avoid doing a completely fresh ubuntu install. Does anyone know of a fix for this?
Thanks in advance!
Edit: Here is my list of installed python packages:
libpython3-dev/noble-updates,noble-security,now 3.12.3-0ubuntu2.1 amd64 [installed,automatic]
libpython3-stdlib/now 3.12.3-0ubuntu2 amd64 [installed,upgradable to: 3.12.3-0ubuntu2.1]
libpython3.12-dev/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
libpython3.12-minimal/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
libpython3.12-stdlib/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
libpython3.12t64/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
python-apt-common/now 2.7.7ubuntu5 all [installed,upgradable to: 2.7.7ubuntu5.2]
python-babel-localedata/noble,now 2.10.3-3build1 all [installed,automatic]
python3-apport/noble-updates,noble-security,now 2.28.1-0ubuntu3.8 all [installed,automatic]
python3-apt/now 2.7.7ubuntu5 amd64 [installed,upgradable to: 2.7.7ubuntu5.2]
python3-aptdaemon.gtk3widgets/noble,now 1.1.1+bzr982-0ubuntu44 all [installed,automatic]
python3-aptdaemon/noble,now 1.1.1+bzr982-0ubuntu44 all [installed,automatic]
python3-attr/noble,now 23.2.0-2 all [installed,automatic]
python3-babel/noble,now 2.10.3-3build1 all [installed,automatic]
python3-blinker/noble,now 1.7.0-1 all [installed,automatic]
python3-bpfcc/noble,now 0.29.1+ds-1ubuntu7 all [installed,automatic]
python3-brlapi/noble,now 6.6-4ubuntu5 amd64 [installed,automatic]
python3-cairo/noble,now 1.25.1-2build2 amd64 [installed,automatic]
python3-certifi/noble,now 2023.11.17-1 all [installed,automatic]
python3-cffi-backend/noble,now 1.16.0-2build1 amd64 [installed,automatic]
python3-chardet/noble,now 5.2.0+dfsg-1 all [installed,automatic]
python3-click/noble,now 8.1.6-2 all [installed,automatic]
python3-colorama/noble,now 0.4.6-4 all [installed,automatic]
python3-commandnotfound/noble,now 23.04.0 all [installed,automatic]
python3-configobj/noble,now 5.0.8-3 all [installed,automatic]
python3-cryptography/noble-updates,noble-security,now 41.0.7-4ubuntu0.1 amd64 [installed,automatic]
python3-cups/noble,now 2.0.1-5build6 amd64 [installed,automatic]
python3-cupshelpers/noble,now 1.5.18-1ubuntu9 all [installed,automatic]
python3-dateutil/noble,now 2.8.2-3ubuntu1 all [installed,automatic]
python3-dbus/noble,now 1.3.2-5build3 amd64 [installed,automatic]
python3-debconf/noble,now 1.5.86ubuntu1 all [installed,automatic]
python3-debian/noble,now 0.1.49ubuntu2 all [installed,automatic]
python3-defer/noble,now 1.0.6-2.1ubuntu1 all [installed,automatic]
python3-dev/noble-updates,noble-security,now 3.12.3-0ubuntu2.1 amd64 [installed,automatic]
python3-distro-info/noble,now 1.7build1 all [installed,automatic]
python3-distro/noble,now 1.9.0-1 all [installed,automatic]
python3-distupgrade/now 1:24.04.27 all [installed,upgradable to: 1:24.04.28]
python3-dnspython/noble,now 2.6.1-1ubuntu1 all [installed,automatic]
python3-gdbm/noble,now 3.12.3-0ubuntu1 amd64 [installed,automatic]
python3-gi/noble,now 3.48.2-1 amd64 [installed,automatic]
python3-gpg/noble,now 1.18.0-4.1ubuntu4 amd64 [installed,automatic]
python3-httplib2/noble,now 0.20.4-3 all [installed,automatic]
python3-ibus-1.0/noble,now 1.5.29-2 all [installed,automatic]
python3-idna/noble-updates,noble-security,now 3.6-2ubuntu0.1 all [installed,automatic]
python3-jinja2/noble-updates,noble-security,now 3.1.2-1ubuntu1.3 all [installed,automatic]
python3-json-pointer/noble,now 2.0-0ubuntu1 all [installed,automatic]
python3-jsonpatch/noble,now 1.32-3 all [installed,automatic]
python3-jsonschema/noble,now 4.10.3-2ubuntu1 all [installed,automatic]
python3-jwt/noble,now 2.7.0-1 all [installed,automatic]
python3-launchpadlib/noble,now 1.11.0-6 all [installed,automatic]
python3-lazr.restfulclient/noble,now 0.14.6-1 all [installed,automatic]
python3-lazr.uri/noble,now 1.0.6-3 all [installed,automatic]
python3-ldb/now 2:2.8.0+samba4.19.5+dfsg-4ubuntu9.3 amd64 [installed,upgradable to: 2:2.8.0+samba4.19.5+dfsg-4ubuntu9.4]
python3-louis/noble,now 3.29.0-1build1 all [installed,automatic]
python3-markdown-it/noble,now 3.0.0-2 all [installed,automatic]
python3-markdown/noble,now 3.5.2-1 all [installed,automatic]
python3-markupsafe/noble,now 2.1.5-1build2 amd64 [installed,automatic]
python3-mdurl/noble,now 0.1.2-1 all [installed,automatic]
python3-minimal/noble-updates,noble-security,now 3.12.3-0ubuntu2.1 amd64 [installed,auto-removable]
python3-netaddr/noble,now 0.8.0-2ubuntu1 all [installed,automatic]
python3-netifaces/noble,now 0.11.0-2build3 amd64 [installed]
python3-netplan/now 1.1.2-2~ubuntu24.04.2 amd64 [installed,upgradable to: 1.1.2-8ubuntu1~24.04.1]
python3-oauthlib/noble,now 3.2.2-1 all [installed,automatic]
python3-olefile/noble,now 0.46-3 all [installed,automatic]
python3-pexpect/noble,now 4.9-2 all [installed,automatic]
python3-pil/noble-updates,noble-security,now 10.2.0-1ubuntu1 amd64 [installed,automatic]
python3-pip-whl/noble-updates,noble-security,now 24.0+dfsg-1ubuntu1.3 all [installed,automatic]
python3-pip/noble-updates,noble-security,now 24.0+dfsg-1ubuntu1.3 all [installed]
python3-pkg-resources/noble-updates,noble-security,now 68.1.2-2ubuntu1.2 all [installed,automatic]
python3-problem-report/noble-updates,noble-security,now 2.28.1-0ubuntu3.8 all [installed,automatic]
python3-ptyprocess/noble,now 0.7.0-5 all [installed,automatic]
python3-pygments/noble,now 2.17.2+dfsg-1 all [installed,automatic]
python3-pyparsing/noble,now 3.1.1-1 all [installed,automatic]
python3-pyrsistent/noble,now 0.20.0-1build2 amd64 [installed,automatic]
python3-requests/noble-updates,noble-security,now 2.31.0+dfsg-1ubuntu1.1 all [installed,automatic]
python3-rich/noble,now 13.7.1-1 all [installed,automatic]
python3-samba/now 2:4.19.5+dfsg-4ubuntu9.3 amd64 [installed,upgradable to: 2:4.19.5+dfsg-4ubuntu9.4]
python3-serial/noble,now 3.5-2 all [installed,automatic]
python3-setuptools-whl/noble-updates,noble-security,now 68.1.2-2ubuntu1.2 all [installed,automatic]
python3-setuptools/noble-updates,noble-security,now 68.1.2-2ubuntu1.2 all [installed,automatic]
python3-six/noble,now 1.16.0-4 all [installed,automatic]
python3-software-properties/now 0.99.49.3 all [installed,upgradable to: 0.99.49.4]
python3-speechd/noble,now 0.12.0~rc2-2build3 all [installed,automatic]
python3-sss/noble-updates,now 2.9.4-1.1ubuntu6.3 amd64 [installed,automatic]
python3-systemd/noble,now 235-1build4 amd64 [installed,automatic]
python3-talloc/noble,now 2.4.2-1build2 amd64 [installed,automatic]
python3-tdb/noble,now 1.4.10-1build1 amd64 [installed,automatic]
python3-typing-extensions/noble,now 4.10.0-1 all [installed,automatic]
python3-tz/noble,now 2024.1-2 all [installed,automatic]
python3-update-manager/noble-updates,now 1:24.04.12 all [installed,automatic]
python3-urllib3/now 2.0.7-1ubuntu0.2 all [installed,upgradable to: 2.0.7-1ubuntu0.6]
python3-venv/noble-updates,noble-security,now 3.12.3-0ubuntu2.1 amd64 [installed]
python3-wadllib/noble,now 1.3.6-5 all [installed,automatic]
python3-wheel/noble,now 0.42.0-2 all [installed,automatic]
python3-xdg/noble,now 0.28-2 all [installed,automatic]
python3-xkit/noble,now 0.5.0ubuntu6 all [installed,automatic]
python3-yaml/noble,now 6.0.1-2build2 amd64 [installed,automatic]
python3.12-dev/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
python3.12-minimal/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
python3.12-venv/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
python3.12/now 3.12.3-1ubuntu0.8 amd64 [installed,upgradable to: 3.12.3-1ubuntu0.11]
python3/now 3.12.3-0ubuntu2 amd64 [installed,upgradable to: 3.12.3-0ubuntu2.1]


















