My apt-get update is broken after installing python3, pop os 20.04 LTS.
I must have installed python3 incorrectly or changed some of the settings for default application use with python versions.
I’m not a linux master and would prefer to not have to reinstall popos.
Here are the errors.
Hit:1 http://apt.pop-os.org/proprietary focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease
Hit:4 http://repository.spotify.com stable InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
Hit:6 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:7 http://ppa.launchpad.net/system76/pop/ubuntu focal InRelease
Hit:8 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
sh: 1: /usr/lib/cnf-update-db: not found
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
Preparing to unpack .../libglib2.0-dev-bin_2.64.3-1~ubuntu20.04.1_amd64.deb ...
/var/lib/dpkg/info/libglib2.0-dev-bin.prerm: 6: py3clean: not found
dpkg: warning: old libglib2.0-dev-bin package pre-removal script subprocess retu
rned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/libglib2.0-dev-bin_2.64.3
-1~ubuntu20.04.1_amd64.deb (--unpack):
new libglib2.0-dev-bin package pre-removal script subprocess returned error exi
t status 127
/var/lib/dpkg/info/libglib2.0-dev-bin.postinst: 6: py3compile: not found
dpkg: error while cleaning up:
installed libglib2.0-dev-bin package post-installation script subprocess return
ed error exit status 127
Preparing to unpack .../libglib2.0-dev_2.64.3-1~ubuntu20.04.1_amd64.deb ...
Unpacking libglib2.0-dev:amd64 (2.64.3-1~ubuntu20.04.1) over (2.64.2-1~fakesync1
) ...
Errors were encountered while processing:
/var/cache/apt/archives/libglib2.0-dev-bin_2.64.3-1~ubuntu20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
(It was done a few weeks ago, I went away on holiday).
I’m pretty sure I had a problem with python3 when I installed it, I couldn’t load gnome programs, so I tried to remove it and was having other problems…
Then I just removed all python versions and installed python manually, I guess that was a mistake.
Python3 is installed by default on the latest versions of PopOS (IIRC). Furthermore, python3 is used by the system for various programs so one cannot cleanly remove all python versions.
If you need to work with multiple python versions it is reccomended to leave the system version alone and simply use pip to create a virtualenv with the python version you need so as to not bork your system.
Since you have a lot of different python versions installed you will probably have to fix what the system expects /usr/bin/python -> /path/to/correct/python_version.
I am unsure how you installed it though and without that information I cannot really help you undo what you did previously.
Link to the guide please? The one on Python’s website?
There should be no need to use make and compile it yourself. It should be available via the repos, or via pip like how I mentioned above.
Since you installed python2.7 its likely this changed your symlink of what python points to so everything that expects /usr/bin/python to be python3 is now getting python2 and malfunctioning.
ls -hal /usr/bin/python*
# and
ls -hal /usr/local/bin/python*
as i said it was a few weeks ago and I cant find the exact guide I followed. But i just wget the 2.7 into the /usr/local/bin directory and installed from there.
So as I suspected, the default version of python that your system sees when calling python is 2.7 and if they want to use python 3.7 they need to use python3.
I am not sure what it was previously though on a fresh system.
But that doesn’t look too out of the ordinary.
What I would suggest next it to uninstall the offending package and clean the metadata.
There’s no /usr/bin/python3, that’ll break any script with that on line 1; if the shebang specifies the full path, no lookup via the PATH will happen and /usr/local/bin/python3 won’t be found. Maybe you could try linking to that: