1

I had the misfortune of trying to install Python 3.8.5 from source tarball manually, and "whoops" -- I managed to overwrite my existing Python installation in the process, and, surprise, surprise -- my Ubuntu 20.04LTS installation did not like that at all.

I'm running Xubuntu (Xfce4+Ubuntu), so those programs relying on Python 3 libraries went more or less haywire and now, a lot of programs that rely on Python libraries no longer work. Sheesh.

I've been trying to scavenge all possible repair guides (via dpkg, apt, removing the directories, purging, attempting to reinstall, you name it) following just about every possible instruction that's been posted here on AskUbuntu and on StackExchange, none of which have worked out for me.

One reason for that could be that I'm getting arm64 compatibility errors with dpkg/apt uninstall attempts, as I'm running my Ubuntu 20.04LTS on a Raspberry Pi 4B. Many of the dpkg/apt errors pointed specifically to no configuration/install options being available for arm64. Which is probably something that needs to be looked into by the devs.

The possibly bright side is here that I do have a perfect disk image (.img) of the entire OS install (backup often, save a lot of rage!) that I can use to mount and transfer files off from (or, in worst case scenario, overwrite the current install altogether) -- it contains the working Python 3.8.x version before this mishap took place, but other than that I'd lose a week's worth of work.

I'm thinking at this point that I'll try to copy the working Python3 version from the backup image version and overwrite all Python3 related files on the install that's now broken as far as Python3 is concerned.

I'm able to use another endpoint to do the copying / rsyncing over the files, but I'd like to know exactly what files should I copy and overwrite from the backup image? Should I just head for /usr/bin/python* and are there any other things to take into consideration? Or is it just a fool's errand at this point and I might as well just re-write the entire system with that 1 week++ old backup and deal with it?

In hindsight... (it being 2020 and all!) -- If only there'd been a forewarning on Python Foundation's pages on NOT to install a newer version than the one provided by your Linux distribution. Oh well, sometimes you gotta learn things the hard way.

Thanks a lot in advance for any help on this issue.

EDIT: My question got stamped with "This question has already been answered." -- Well, I did as instructed at Removed Python 3 and now Ubuntu Software Center, terminal and other applications don't work (where I was pointed to) and things only got from bad to worse.

Someone obviously went TL;DR and completely ignored the point of me just wanting to replace the Python 3.8.5 by overwriting the installation straight off a working backup clone of the OS drive, as nothing else seemed to work. A simple overwrite-copy to Python-related files, that's all.

After following the instructions in the link above (mainly: uninstall python via apt, reboot, reinstall), I only ended up having all my PPA repositories list thrown out the window just like the majority of my previously up-to-date packages, and to top it all off, apt & dpkg are now just throwing out errors as they're desperately trying to downgrade to previous-version packages (newer versions of which were only in the additional PPA repositories) and causing even more cracks in the functionality of the OS overall while at it, since dpkg NOR apt can't seem to solve the issue with the broken packages any longer.

I.e.: sudo apt update now only leads up to:

Hit:1 http://archive.canonical.com/ubuntu focal InRelease Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-proposed InRelease Hit:7 https://apt.llvm.org/focal llvm-toolchain-focal-10 InRelease sh: 1: /usr/lib/cnf-update-db: not found Reading package lists... Done N: Skipping acquire of configured file 'main/binary-arm64/Packages' as repository 'http://apt.llvm.org/focal llvm-toolchain-focal-10 InRelease' doesn't support architecture 'arm64' 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

Note to self, and perhaps to future generations (if there are any): "Shooting a mosquito with a bazooka may yield unwanted results." - as for this Ubuntu 20.04LTS install, I'd say it's pretty much FUBAR at this point. Time to just replace the entire install from the backup image. Multiple lessons learned, including that not all proposed solutions over here are exactly helpful. Good day.

6
  • 1
    Softwares installed in Ubuntu depend heavily on Python. It is always a good idea not to interfere with the default Python installation. If you really want to update Python, use this PPA instead. launchpad.net/~deadsnakes/+archive/ubuntu/ppa . By the way, you can install multiple python versions (eg. sudo apt install python3.9 and similarly python3.8) from the PPA, and also, it hosts Python 3.8.5. Commented Aug 24, 2020 at 13:57
  • 1
    Since this was closed, I'll have to answer in a comment. Go to packages.ubuntu.com/focal/python3 and note two things: you can click on [list of files] for the package to see the files in that package and see the dependencies. For "python3" and each of its dependencies, you'll probably want to copy those files over from your clean image. If you want to compile from source, I recommend doing "make localinstall" instead of "make install" as your last step. Commented Aug 24, 2020 at 13:58
  • @ArchismanPanigrahi Thank you for the reply. I did know that it's not a good idea to interfere with the installation as I explained from the get-go -- I made an accident there that was my own fault for trying to fix Python issues with a source tarball installation. Perhaps a bit too long of a day to sort those kind of problems out. So, PEBKAC from the beginning, as the old saying goes. ":)" Thanks for the Deadsnakes PPA link -- I had already checked that one out during this whole ordeal. Maybe I was looking at the wrong PPA, but there was some issues with finding a suitable build for ARM64. Commented Aug 24, 2020 at 14:44
  • 1
    Oh, I just found that they don't build Python 3.8 for Ubuntu 20.04 in the PPA (presumably because Python 3.8.2 is already available there). Unless you really need some feature that is present in Python 3.8.5 but absent in 3.8.2, don't mess up with Python :-) Commented Aug 24, 2020 at 14:48
  • @BrianTurek - I'm already solving the problem by salvaging my week's worth of work the best I can and then just scuttling the current OS installation altogether and pulling out the backup image and just dealing with it. "Save & backup often", they says. Especially when it's a RPi4B ARM64/aarch64 environment, a lot of the usual instructions out there simply won't apply in many cases since there's no support--or even documentation-- so, the downside of 'cutting edge' is that the scout's knife cuts both ways. You win some, you lose some. Have a great day, nonetheless. Cheers. Commented Aug 24, 2020 at 14:50

0

You must log in to answer this question.