installation problems on Ubuntu 20.04

29 views
Skip to first unread message

Greg Edwards

unread,
Apr 23, 2023, 6:16:05 AM4/23/23
to leo-editor
I've followed the directions at https://leo-editor.github.io/leo-editor/installing.html, including 
pip3 install PyQt6
pip3 install leo

And when I run leo, I get an error
which leo
> /home/linuxbrew/.linuxbrew/bin/leo
leo
> 'NoneType' object has no attribute 'gui'

Help?

Thanks,
Greg

Thomas Passin

unread,
Apr 23, 2023, 8:05:46 AM4/23/23
to leo-editor
Try running 

python3 -m leo.core.runLeo

If this succeeds then Leo has been installed properly, and the problem is with the launcher "leo".  What version of Python 3 do you have?  Leo requires at least python3.9.

Whatever the problem is, Leo normally runs fine on both Ubuntu 20.0x and 22.0x, so the issue would be specific to your machine.

Greg Edwards

unread,
Apr 23, 2023, 8:08:19 PM4/23/23
to leo-e...@googlegroups.com
python3 --version
3.11.3

 When I run that command you suggested in the git checkout directory, I get the same error as before.

--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/hzk0zlSv5BY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/d11f423c-f8ee-4568-9972-515f90bb04a6n%40googlegroups.com.

Mike Hodson

unread,
Apr 23, 2023, 8:40:27 PM4/23/23
to leo-e...@googlegroups.com
My first question of concern is why is there a homebrew path where this is installing? As far as I know pip should install into a local Python system-wide directory, or into a user directory if given the --user option.

Second, with Ubuntu 20.04, do you actually have QT version 6? I'm not certain of the state of things with QT version 5 and Leo, however you might need to try installing the PyQT5 package instead.

That said I'm using Ubuntu 22.10 with plasma KDE backports, and I'm having a very reasonable time with it. I would suggest upgrading because 20.04 will continue to have outdated packages until it's end of life, which is how a stable distribution works.

23.04 is already out and I am planning a distupgrade to it soon.

I hope this perhaps leads to some success on your end.

Mike



--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/7a44ecc6-56c5-4579-99f0-305f8b585af2n%40googlegroups.com.

Thomas Passin

unread,
Apr 23, 2023, 9:44:53 PM4/23/23
to leo-editor
I cannot speak to the homebrew thing.  But I'm pretty sure that the system version of Python3 is lower than 3.11.  So there could be some confusion about where - in what version of python - things are getting installed.  Not having PyQt6 might be a problem, though Leo can use either PyQt5 or 6 depending on what is available.

Here is what I suggest.  First of all, always pip-install using python3 -m pip install ... (or use the name you use if it's not "python3").  This makes sure that pip is being run by and installing into the intended version of Python.

Second, run python3 -m pip list |grep -i "qt".  This will show you what version if any of Qt has been installed for the version of Python that is actually running.

Remember that this version of Python may not be the same as the system-installed one, especially if a homebrew path is involved.

Next, run python3 -m pip show leo to see if Leo is installed. for this Python installation.

If not, or if PyQT isn't installed, try to install Leo from PyPi with pip.  You can worry about getting the latest devel version from GitHub later.  Doing it this way will install all the dependencies you need:

python3 -m pip install --user --upgrade leo

If this succeeds and Leo runs using python3 -m leo.core.runLeo, then we can go on from there. All Leo's dependencies will have been installed.

I'm afraid I forgot something in my previous suggestion.  You said you had cd'ed to the git checkout directory.  I'm not sure that in itself is enough for the paths to work right.  The best way is not to be in the checkout directory, but to export the leo-editor directory to $PYTHONPATH before running Leo.  I do that using a batch file that sets the variable and then runs Leo.  Or you could use a venv or install with --editable, but my way is the most direct for troubleshooting.

I have installed Leo from PyPi and github many times in various versions of Ubuntu (all virtual machines on a Windows host), and so I know it can be done and usually without a problem.  But as I say, I don't know anything about homebrew and how it may be changing how things work.

Greg Edwards

unread,
Apr 24, 2023, 8:07:30 PM4/24/23
to leo-e...@googlegroups.com
I'm on a brand new install of Ubuntu 20.04. Here's what I did, and
the problem remains. Thoughts?

python3 --version
> Python 3.11.3

python3 -m pip install --user --upgrade leo
> <snip> Successfully installed leo-6.7.2

python3 -m pip show leo
> Name: leo
> Version: 6.7.2
> Summary: An IDE, PIM and Outliner
> Home-page: http://leo-editor.github.io/leo-editor
> Author: Edward K. Ream
> Author-email: edre...@gmail.com
> License: MIT License
> Location: /home/greg/.local/lib/python3.11/site-packages
> Requires: asttokens, black, build, docutils, flexx, meta, nbformat, pyenchant, pyflakes, pylint, PyQt5, PyQtWebEngine, pyshortcuts, sphinx, tk
> Required-by:

python3 -m pip list | grep -i "qt"
> PyQt5 5.15.9
> PyQt5-Qt5 5.15.2
> PyQt5-sip 12.12.1
> PyQtWebEngine 5.15.6
> PyQtWebEngine-Qt5 5.15.2
> sphinxcontrib-qthelp 1.0.3

python3 -m leo.core.runLeo

> 'NoneType' object has no attribute 'gui'
>
> *** Leo could not be started ***
> Please verify you've installed the required dependencies:
> https://leoeditor.com/installing.html
> You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/hzk0zlSv5BY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/97ca4600-64f6-4f15-9c4a-883faef0cc18n%40googlegroups.com.

Thomas Passin

unread,
Apr 24, 2023, 10:30:21 PM4/24/23
to leo-editor
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.
Reply all
Reply to author
Forward
0 new messages