Install Leo on wsl2 Debian

62 views
Skip to first unread message

lewis

unread,
Jul 29, 2024, 4:33:44 AM7/29/24
to leo-editor
On my Windows10 system I have installed wsl2 running Debian.
Both pip and github are installed.
I deliberately did not install any packages with git (e.g docutils) as I wanted the the simplified installation with `pip install -r requirements.txt` to proceed on it's own.

$ git clone https://github.com/leo-editor/leo-editor.git
$ pip install -r requirements.txt

Result:
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.



So I installed pipx and tried

$ pipx install leo-editor
Fatal error from pip prevented installation. Full pip output in file:
    /home/lewisneal/.local/pipx/logs/cmd_2024-07-29_17.50.19_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement leo-editor (from versions: none)
    ERROR: No matching distribution found for leo-editor

Error installing leo-editor.

The errors.log does not have any new info.

Has anyone had success running Leo from a WSL2 linux session?
Any advice on what to try now?

Thanks

lewis

unread,
Jul 29, 2024, 5:08:55 AM7/29/24
to leo-editor
Some progress :)
Leo is installed at /home/lewisneal/leo-editor

lewisneal:~/leo-editor$ python3 launchLeo.py
Error starting Leo!
Please verify you've installed the required dependencies:
https://leo-editor.github.io/leo-editor/installing.html
Please ask for help at https://groups.google.com/g/leo-editor

Traceback (most recent call last):
  File "/home/lewisneal/leo-editor/leo/core/runLeo.py", line 45, in <module>
    from leo.core import leoApp
  File "/home/lewisneal/leo-editor/leo/core/leoApp.py", line 21, in <module>
    from leo.core.leoQt import QCloseEvent
  File "/home/lewisneal/leo-editor/leo/core/leoQt.py", line 5, in <module>
    from PyQt6 import QtCore, QtGui, QtWidgets
ModuleNotFoundError: No module named 'PyQt6'
lewisneal:~/leo-editor$ pwd
/home/lewisneal/leo-editor


lewisneal:~$ sudo pipx install PyQt6
[sudo] password for lewisneal:
  installed package pyqt6 6.7.1, installed using Python 3.11.2
  These apps are now globally available
    - pylupdate6
    - pyuic6
⚠️  Note: '/root/.local/bin' is not on your PATH environment variable. These
    apps will not be globally accessible until your PATH is updated. Run `pipx
    ensurepath` to automatically add it, or manually modify your PATH in your
    shell's config file (i.e. ~/.bashrc).
done! ✨ 🌟 ✨
lewisneal:~$

lewisneal:~$ pipx ensurepath
Success! Added /home/lewisneal/.local/bin to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for
instructions.

You will need to open a new terminal or re-login for the PATH changes to take
effect.

Otherwise pipx is ready to go! ✨ 🌟 ✨
lewisneal:~$

However I still get error:
lewisneal:~/leo-editor$ python3 launchLeo.py
Error starting Leo!
Please verify you've installed the required dependencies:
https://leo-editor.github.io/leo-editor/installing.html
Please ask for help at https://groups.google.com/g/leo-editor

Traceback (most recent call last):
  File "/home/lewisneal/leo-editor/leo/core/runLeo.py", line 45, in <module>
    from leo.core import leoApp
  File "/home/lewisneal/leo-editor/leo/core/leoApp.py", line 21, in <module>
    from leo.core.leoQt import QCloseEvent
  File "/home/lewisneal/leo-editor/leo/core/leoQt.py", line 5, in <module>
    from PyQt6 import QtCore, QtGui, QtWidgets
ModuleNotFoundError: No module named 'PyQt6'


Thomas Passin

unread,
Jul 29, 2024, 6:37:53 AM7/29/24
to leo-editor
I haven't used pipx, but two things come to mind, and maybe you have covered the first already.

1. Log out and log in again (or better, reboot since there are new global paths involved) to make sure that the new paths actually get exported. This is the first resort for problems after changing paths.  pipx may have changed the scripts that set the new paths but it probably didn't source them.
2. I would have installed Qt6 (and Leo) using --user to avoid potential version conflicts with system programs (maybe pipx automatically does the equivalent, I don't know)

lewis

unread,
Jul 29, 2024, 7:39:07 AM7/29/24
to leo-editor
My mistake :)
I incorrectly used
$ pipx install leo-editor

The correct command is
$ pipx install leo

The adventure continues....

So using pipx has worked and I have Leo 6.8.1 release running with wsl2 Debian.
The github installation method seems to have failed for me.

Mike Hodson

unread,
Jul 29, 2024, 7:42:41 AM7/29/24
to leo-e...@googlegroups.com
Out of curiosity, did you attempt 
pipx install -r requirements.txt
?

Mike

lewis

unread,
Jul 29, 2024, 8:09:38 AM7/29/24
to leo-editor
Hi Mike,
Good question. Not yet but I will soon.
I want to get familiar with customising Leo on linux e.g. with myLeoSettings.leo file. I'm not keen on breaking a working system :)

I might try 'pipx install -r requirements.txt ' on another wsl distro.

Thomas Passin

unread,
Jul 29, 2024, 9:04:13 AM7/29/24
to leo-editor
I haven't found the need for any differences in myLeoSettings.leo between Windows and Linux, unless of course a setting points to a specific path or program, like an external text editor.  I have sometimes wanted to adjust font sizes in theme files, either for the tree or the body. Changing the body font or font size might make you want to adjust the gutter settings, especially the y height adjustment You might also want to install one or another fonts requested by the theme, such as Intel Mono, if they aren't installed in your system.

I've been reluctant to install a WSL distro on my Windows 10 machine in case something would go wrong and mess up Windows itself.  Was it pretty straightforward?

lewis

unread,
Jul 30, 2024, 6:53:44 AM7/30/24
to leo-editor
On Monday, July 29, 2024 at 9:42:41 PM UTC+10 mys...@gmail.com wrote:
Out of curiosity, did you attempt 
pipx install -r requirements.txt
?

Mike

Running wsl2 Ubuntu I just tried:
pipx install -r requirements.txt
[snip]
pipx: error: unrecognized arguments: -r

Currently pipx does not support using a requirements.txt file. See https://github.com/pypa/pipx/issues/1031

Mike Hodson

unread,
Jul 30, 2024, 7:05:45 AM7/30/24
to leo-e...@googlegroups.com
Ah, sorry for having you bark up the wrong tree.

I was not certain it would work and I admit to not having tried it myself, my initial thought was that it would work very similarly to the regular pip commandment but apparently does not.

That said, the warning for pip installing things that conflict with system libraries is endemic on pretty much every new distribution, regardless of being installed within WSL or otherwise [bare metal, vm, container] non-specific. 

I believe the current recommendation is to use a python virtual environment, which is a little bit of extra commands to make it work but it does work well. I would suggest looking through the group archive as I remember a lot of people have talked about this in the past. 

Again, my apologies for not realizing a similar pipx command was not possible. 

Mike



Thomas Passin

unread,
Jul 30, 2024, 8:26:07 AM7/30/24
to leo-editor
"I  believe the current recommendation is to use a python virtual environment, which is a little bit of extra commands to make it work but it does work well. I would suggest looking through the group archive as I remember a lot of people have talked about this in the past"

I started installing into --user with --break-system-packages.  I reasoned that Leo's dependencies would probably not affect the system install, and if they would, the system would already have installed its preferred version.  What one would want to avoid is that Leo's install would try to update a package that system depends on.  So far so good.

With some Linux VMs I have been starting to use venvs. I understand the benefits but it's a nuisance for me to remember what VMs use them and what ones don't. and to remember to source bin/activate instead of just bin/activate.

lewis

unread,
Jul 30, 2024, 9:17:57 AM7/30/24
to leo-editor
On Monday, July 29, 2024 at 11:04:13 PM UTC+10 tbp1...@gmail.com wrote:
I've been reluctant to install a WSL distro on my Windows 10 machine in case something would go wrong and mess up Windows itself.  Was it pretty straightforward?
 
I didn't find the installation straightforward due to the problem with git and pip install -r requirements.txt
However I persisted, my Windows system is not messed up, and Leo runs.
myLeoSettings.leo file works fine on wsl2 running Debian and Ubuntu.

I found this statement confusing:
   If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

So you install pipx and use it to install leo. It creates venvs for you at .local/pipx/venvs/leo/
but pip does not recognise it.

I would like to understand if PEP 668 affects all linux installs this way.

Thomas Passin

unread,
Jul 30, 2024, 10:02:38 AM7/30/24
to leo-editor
PEP 668 refers to this document as being the definitive one: Externally Managed Environments. Reading it, I see that everything is optional and has to be set up by the distro's packaging people.  Some of the these people may understand the ins and outs better than others, so the way these details are set up can be different between distros.

IOW, Linux business as usual.


Thomas Passin

unread,
Jul 30, 2024, 12:04:51 PM7/30/24
to leo-editor
I meant installing WSL itself  and the Linux distro on it. I saw some instructions a while ago and it seemed tricky, or at least fussy.

On Tuesday, July 30, 2024 at 9:17:57 AM UTC-4 lewis wrote:
Reply all
Reply to author
Forward
0 new messages