Well, you've sure stumped me. Everything you've posted looks correct, and the file locations are what one would expect. The one thing I don't quite see is how you have Python3.11 on Ubuntu 20.04. I only have 3.10.6 on Ubuntu 22.04. Also, I have both PyQt5 and PyQt6, and Leo goes with PyQt6 by preference. But that shouldn't matter.
One thing might be that your system is missing some shared lib (like libsomething.so) that Qt needs. I saw that on one VM, but I forget all the details. It might be worthwhile to see if PyQt actually works. For starters, you could run an interpreter session and import PyQt5. If that works, then copy the following code to a file - e.g., little-qt-tester.py - and try to run it.
"""A basic qt app with a MainWindow.
Based on
https://www.learnpyqt.com/courses/adanced-ui-features/creating-multiple-windows
"""
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QVBoxLayout, QWidget
class AnotherWindow(QWidget):
"""
This "window" is a QWidget. If it has no parent, it
will appear as a free-floating window as we want.
"""
def __init__(self):
super().__init__()
layout = QVBoxLayout()
self.label = QLabel("Another Window")
layout.addWidget(self.label)
self.setLayout(layout)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.button = QPushButton("Push for Window")
self.button.clicked.connect(self.show_new_window)
self.setCentralWidget(self.button)
def show_new_window(self, checked):
# Note that we assign the new window to self. If we didn't,
# e.g., w - AnotherWindow() - w would go out of scope when the method
# completed. Then it would be deleted and garbage collected,
# and the new window would close at once.
self.w = AnotherWindow()
self.w.show()
def main():
app = QApplication(sys.argv)
w = MainWindow()
w.show()
app.exec_()
if __name__ == '__main__':
main()
If this program succeeds, then at least we know that PyQt5 has what it needs to run. If it fails, maybe there will be a helpful error message. I tried this program just now on my Ubuntu 22.04 VM system and it ran correctly. It opens a small window filled with a pushbutton. Clicking on the pushbutton opens a second, smaller window. It also runs as is on Windows.
If this program runs correctly, I'm afraid I'm more or less out of ideas. But try it out and maybe I'll come up with something. We can hope that someone else recognizes something familiar, One thing that surprises me is the lack of error messages, so we're flying blind. It's always possible, I suppose, that the version of PyQt5 you've got wasn't built right for Python3.11, but if so you would think there would be an error message of some kind. Also on some other VM (IIRC) I do have Python 3.11, and Leo works there.
If the above doesn't shed light on the problem, then if you have the patience I would try to create a virtual machine that uses a different Linux distro, like Mint, and see if you can get Leo working on that. I don't mean that you should use Leo that way day to day, but it would let you see that the install steps worked (or not).
Another thing I might try if it were my system is to see if I could install a version of Python 3.10 along side of the 3.11 that's already there. Then you would repeat the Leo install, but type
python3.10 everywhere instead of
python3. It would be best to get the install package from
python.org instead of any other source.