Quick steps on how I got Leo working on Windows 11

198 views
Skip to first unread message

Satheesh Vattekkat

unread,
Oct 14, 2023, 9:02:27 AM10/14/23
to leo-editor
Got a new Windows 11 laptop and since I haven't used Windows for a while, had to spend some time getting Leo to be installed. Ran into few problems along the way - in Linux and OSX it was always a breeze.

Added what finally worked for me as a gist, if it helps anyone.


Note that this may not be the most elegant way on Windows, but I am no Windows expert :) 

I am running this directly from git cloned directory rather than installing that as a pip and then running it. I do a git pull daily and so far it is all working good for last 3 days.

HTH

Thomas Passin

unread,
Oct 14, 2023, 10:01:44 AM10/14/23
to leo-editor
I'd say this is how to get it installed using Anaconda, which apparently is not the same as using Python from python.org.  For one thing, using python.org you don't have to install build tools to build pyqt5 (and note that Leo will also work with pyqt6) - pip installs a pre-built package. 

Satheesh Vattekkat

unread,
Oct 14, 2023, 11:09:53 AM10/14/23
to leo-editor

I had python 3.12 installed via scoop already. That failed at PyQt5 installation needing vs build tools. That’s when I tried with Anaconda. Will need to check if scoop installs python from python.org or not.

Thanks!

David Szent-Györgyi

unread,
Oct 15, 2023, 11:13:14 AM10/15/23
to leo-editor
On Saturday, October 14, 2023 at 10:01:44 AM UTC-4 tbp1...@gmail.com wrote:
I'd say this is how to get it installed using Anaconda, which apparently is not the same as using Python from python.org.  For one thing, using python.org you don't have to install build tools to build pyqt5 (and note that Leo will also work with pyqt6) - pip installs a pre-built package. 

The Anaconda distribution of Python is aimed science-related computing - data science, including life science and bioinformatics - in which Python sees much use. It addresses the headaches of packaging Python code and applications, and comes with a much-expanded set of Batteries Included. 

Matt Wilkie

unread,
Oct 16, 2023, 12:17:14 AM10/16/23
to leo-editor
Here's my recipe. Building qt and Anaconda are not needed.

Installing Leo from scratch on a new machine, following my preferences, some adjustment may be needed to match yours.

 

Overview

All but step 1 can be done from the command line, below.

 

  1. Install the winget command line package manager by installing App Installer from Microsoft Store.
  2. Download refreshenv.cmd in place in PATH (optional).
  3. Install python launcher, a shortcut to all the python installs on a system.
  4. Install python from Python Software Foundation.
  5. Install pipx, for managing python programs as applications.
  6. Fetch Leo (choose from pypi.org or source code)
  7. Install Leo
  8. Register Leo with Windows

 

 

From a CMD shell (https://gist.github.com/maphew/fe6e5c2ccbf48fc82d84b4230e476899):

 

winget install wget

md c:\bin

wget https://raw.githubusercontent.com/chocolatey/choco/blob/master/src/chocolatey.resources/redirects/RefreshEnv.cmd -O c:\bin\RefreshEnv.cmd

setx /M path %path%;c:\bin

 

winget install --id Python.Launcher --exact --force

winget install python.python.3.12 --location c:\apps\python

 

refreshenv

py -0

where python

 

sudo setx /M PIPX_BIN_DIR C:\bin

sudo setx /M PIPX_HOME C:\apps\pipx

c:\apps\python\python.exe -m pip install pipx

c:\apps\python\python.exe -m pipx ensurepath

refreshenv


Choose:

 

:: Install latest stable release from pypi.org

pipx install leo

 

    Or:

:: Or install latest development from GitHub with git

pushd %userprofile%\code

git clone --depth=50 --no-single-branch https://github.com/leo-editor/leo-editor

pipx install --editable ./leo-editor

 

    Or:

:: Or install latest development from source code download

winget install 7zip

pushd %userprofile%\Downloads

wget https://github.com/leo-editor/leo-editor/archive/devel.zip

7z x devel.zip -o C:\apps
pipx install --editable C:\apps\leo-editor-devel

 

Resume


pipx inject leo websockets


leo-messages --version

 

:: run Leo to create profile and related, and then exit

Leo

 

:: Register Leo with Windows

leo-m --script=C:\apps\pipx\venvs\leo\Lib\site-packages\leo\scripts\add-desktop-links.leox

leo-m --script=C:\apps\pipx\venvs\leo\Lib\site-packages\leo\scripts\win\register-leo.leox

 

Notes

Python, pipx, and Leo are installed globally outside of user profile directory tree.

Several listed commands are optional. For example `where python` is merely a sanity check to see it it's in PATH and what folder it's in.


Pipx is for installing python programs in their own virtual environment, so they behave like regular programs that can have independent python versions and depencies from other python programs. It's lighter weight than conda and simpler than managing venvs directly.


Registering Leo with Windows can be done interactively via "Leo menu >> Settings >> Open desktop integration".


Websockets is optional, it's for using LeoInteg extension in Visual Studio Code.


----

-matt

Thomas Passin

unread,
Oct 16, 2023, 12:27:08 AM10/16/23
to leo-editor
sudo setx /M PIPX_BIN_DIR C:\bin

Where did we get sudo from? Does it come with winget?  
Did this work for Leo with Python 3.12?  Because something seems to be mis-configured with what's on PyPi right now, and it doesn't work.

Matt Wilkie

unread,
Oct 16, 2023, 12:33:24 AM10/16/23
to leo-editor
Thanks for the feedback!

My mistake. Sudo comes with Gsudo, and I forgot I had done that. (`winget install gsudo`).

Installing Leo from Pypi on Py v3.12 will not work until next Leo release (see https://github.com/leo-editor/leo-editor/pull/3612 and https://github.com/leo-editor/leo-editor/issues/3615)
So that's also my mistake, since I specified 3.12 at the top.

-matt

Matt Wilkie

unread,
Oct 16, 2023, 12:38:52 AM10/16/23
to leo-editor

Additional note: Refreshenv allows carrying out all commands in a single session. Without this opening a new CMD shell several times to catch changes each of the installs make is necessary.

Thomas Passin

unread,
Oct 16, 2023, 7:49:30 AM10/16/23
to leo-editor
On Monday, October 16, 2023 at 12:33:24 AM UTC-4 map...@gmail.com wrote:
Installing Leo from Pypi on Py v3.12 will not work until next Leo release (see https://github.com/leo-editor/leo-editor/pull/3612 and https://github.com/leo-editor/leo-editor/issues/3615)

That's because of the windows-curses problem, which may never be available (although it seems to me that someone motivated enough could get it working for Python 3.12; it's pretty involved and that person is not me).  I did find an workaround which I explained in another thread: you can Install Leo For Python 3.12 Using Python 3.11. Very easy and quick.
Reply all
Reply to author
Forward
0 new messages