5

I have a critical PyQt5 application which is still in the migration to Python3 phases.
K/Ubuntu 20.04 has removed the required packaging to install PyQt5 for Python 2.7. I understand the importance of these apps to migrate to Py3, but I'm the user who still needs the apps. I'm glad Ubuntu has made Python 2.7 still available, even if they've made Py3 the default. But I need to have continued access to this and couple other apps, and I would like to be able to upgrade all my systems to Ubuntu 20.04. Expressly, I need PyQt5 and QtWebKit (yes, I know QtWebKit was also deprecated).

I am trying not to make my machine too much of a mess in the process. Would like an elegant and simple method.

So far, I've tried numerous incantations of pip install (although I will humbly accept if someone is able to make it work through Pip)

I've added in previous deb repos from previous Ubuntu versions, Eoan and Bionic, and had no luck so far. I don't doubt there is a way to make this approach successful... but I haven't found it yet. I'd love for some help.

I have many colleagues who also use this software. Best answer for me would be one I could easily point others to and have them not need to be a master of the Linux universe. Preferably not "download source and start compiling".

Thanks in advance!

kurios
  • 81
  • 1
  • 4
  • 1
    Do you really mean PyQt5? Maybe you mean PyQt4 which is really got removed from 20.04 LTS. What is the name of "critical PyQt5 application"? Is it opensource and/or freely available to test by us? Can you share a link to it? – N0rbert Jun 27 '20 at 17:28
  • Part of reason I keep my 16.04 & 18.04 installs. But have not had to boot 16.04 since 18.04 installed. Can you install in Virtual Box an older copy & use it? – oldfred Jun 27 '20 at 18:16
  • It sounds like this app is more important than upgrading to v20; I would just wait until the migration to Python3 is complete. – ajgringo619 Jun 28 '20 at 03:43
  • not a direct solution but why not use https://www.pyinstaller.org/ to build a exe – EchoMike444 Jun 28 '20 at 04:42
  • Apologies for the delayed response, I'm new to posting on AskUbuntu and didn't receive notice of your questions. The tool is OpenSource, and while it's going through the Py3 transition, it's not there yet. You can see it here:

    https://github.com/vivisect/vivisect

    – kurios Jul 03 '20 at 14:24
  • @N0rbert, nope, I meant PyQt5. PyQt5 works for Python 3, but not for Python 2, which this app requires. Thanks! btw, you can pip install vivisect – kurios Aug 05 '20 at 18:19
  • @oldfred I actually just installed a new 18.04 VM for that purpose. It's not the same, but it helps. I'm really a fan of getting around artificial limitations (like the deprecation of Python 2), and like to find creative (and often simple) solutions to problems like this. But thank you for the suggestion. – kurios Aug 05 '20 at 18:23
  • @ajgringo619, almost. There are other benefits I'm seriously reaping from 20.04. It's been a tough struggle. 20.04 has some real improvements over 18.04 (eg. external monitors don't take 30 seconds in KDE to be recognized, KDE Bluetooth works out of the box on the devices I use, etc...) – kurios Aug 05 '20 at 18:24
  • It has been many years that they said they were depreciating python2. I converted my own app from python2 & qt4 to py3 & qt5 over 4 years ago. But it was relatively simple & easy to convert. Over 90% was done by the py2to3 program. – oldfred Aug 05 '20 at 19:56

2 Answers2

10

attempting to install Bionic's python2/pyqt5 packages on 20.04 breaks because the 18.04 python-pyqt5 requires qtbase-abi-5-9-5 which causes significant conflicts on 20.04 if you try to install it. however, that package provides nothing necessary. therefore, provide your own, to fulfill that dependency.

here's the solution (high level):

  • install this qtbase-api-fake deb package to fulfill the qtbase-abi requirement. the package is literally nothing but an empty file.
  • add bionic back into your apt repositories
  • install python-pyqt5.qtwebkit (which will install python-pyqt5)

detailed solution:

  1. build the qtbase-abi-fake package and install it. you can simply copy and paste this into a terminal once you're comfortable i have done nothing nefarious:
# create the package structure:
cd /tmp
mkdir qtbase-abi-fake
mkdir -p qtbase-abi-fake/DEBIAN
mkdir -p qtbase-abi-fake/usr/lib/qtbase-abi-fake
touch qtbase-abi-fake/usr/lib/qtbase-abi-fake/nothing.txt

create the deb control file (the guts):

cat <<_EOF > qtbase-abi-fake/DEBIAN/control Package: qtbase-abi-fake Version: 5.9.5 Section: custom Priority: optional Architecture: all Essential: no Installed-Size: 1024 Maintainer: atlas Description: Fakes out python-pyqt5 from Ubuntu 18.04 to work on 20.04
Provides: qtbase-abi-5-9-5 _EOF

build the qtbase-abi-fake.deb file:

dpkg-deb --build qtbase-abi-fake

install your newly created deb file:

sudo dpkg -i qtbase-abi-fake.deb

  1. add bionic to apt repos:
echo 'deb http://us.archive.ubuntu.com/ubuntu/ bionic universe multiverse' | sudo tee /etc/apt/sources.list.d/bionic-helper.list
  1. install the necessary libraries (for vivisect, you want python-pyqt5.qtwebkit):
sudo apt update
sudo apt install python-pyqt5.qtwebkit

that should get you a working python2 pyqt5 environment with qtwebkit.

this fix makes Bionic 18.04's python-pyqt5 work on Focal 20.04, so all the packages that depend on it (like qtwebkit) work as well.

once you build this, you can share it with your friends. i would have provided the deb file here, but there's no easy way to do it. plus this way, you get to see what's going on at each step.

hope this helps! @

atlas
  • 101
  • Thanks! This worked great! And on the machines I had already manually installed python-pyqt5 using dgpk, installing qtbase-abi-fake resolved my issues and I'm able to install/upgrade software again. :)

    Now, just need the Vivisect maintainers to complete the Py3 migration!

    – kurios Aug 06 '20 at 14:27
  • yeah, i know. we're working on it :)

    we finally git vivisect into PyPi, we're merging in a couple massive architecture and analysis branches, and then Py3 is top priority.

    – atlas Aug 06 '20 at 14:28
  • 3
    Thanks. Now I can install HPLIP 3.21.2 on Ubuntu 20.04.2 – shmu Feb 23 '21 at 08:33
  • And I installed HPLIP 3.22.2 on Ubuntu 20.04.4! Thanks! – alexg Mar 18 '22 at 14:51
1

Best temporary solution so far (with caveat):

$ wget http://us.archive.ubuntu.com/ubuntu/pool/universe/p/pyqt5/python-pyqt5_5.10.1+dfsg-1ubuntu2_amd64.deb
$ wget http://us.archive.ubuntu.com/ubuntu/pool/universe/p/pyqt5/python-pyqt5.qtwebkit_5.10.1+dfsg-1ubuntu2_amd64.deb
$ dpkg -i --force-depends python-pyqt5_5.10.1+dfsg-1ubuntu2_amd64.deb
$ dpkg -i python-pyqt5.qtwebkit_5.10.1+dfsg-1ubuntu2_amd64.deb

This will allow my app to work. However, each time I apt install or apt upgrade, it complains about the broken dependency and refuses to install or update until I resolve it. Probably the best answer would be to create a .deb package that provides qtbase-abi-5-9-5 which is what the broken dependency is. This appears to be Ubuntu's way of making Python2.7 QT hooks not work.

Anyone have ideas on a better solution (until the app is ported to Py3)? Is there a way to make apt work properly, while ignoring this particular broken dependency?

kurios
  • 81
  • 1
  • 4