Need help installing Leo on Windows

278 views
Skip to first unread message

User User

unread,
Oct 3, 2022, 7:07:11 AM10/3/22
to leo-editor
Hi everyone,

many thanks to Edward and the community for beautiful Leo. Need your help installing it on Windows.

I usually work in Linux and install Leo successfully by downloading and unpacking leo-editor-6.3.zip and running launchLeo.py with gui=qt key. However, it did not work for me in Windows.

I already have Python and Qt on my PC. This is what I tried:
C:\Users\user>python C:\Users\user\OneDrive - User\Apps\Leo\leo-editor-6.3\launchLeo.py --gui=qt
It fails: can't find '__main__' module in 'C:\\Users\\user\\OneDrive'

When I try to run pip install according to Installing from sources recommendations I get:
C:\Users\user>pip install -editable C:\Users\user\OneDrive - User\Apps\Leo\leo-editor-6.3
ERROR: Directory 'C:\\Users\\user\\OneDrive' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.

"Installing Leo with pip" recommendation did not work for me either. Also, I prefer Leo 6.3.

Appreciate any advice on how to install Leo (ideally, 6.3) on Windows!

Kind regards, Serhii

User User

unread,
Oct 3, 2022, 7:11:03 AM10/3/22
to leo-editor
Update: trying to deal with whitespace in the path did not help:

C:\Users\user>pip install -editable "C:\Users\user\OneDrive - User\Apps\Leo\leo-editor-6.3"
ERROR: ditable is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

User User

unread,
Oct 3, 2022, 7:23:41 AM10/3/22
to leo-editor
I also tried to avoid cloud storage and whitespace issues by copying Leo to another folder, but it did not help either:
C:\Users\user>pip install -editable C:\Users\user\Apps\Leo\leo-editor-6.3

ERROR: ditable is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

Thomas Passin

unread,
Oct 3, 2022, 8:30:48 AM10/3/22
to leo-editor
I believe you need to type two dashes for the "editable" parameter:

pip install --editable ....

Thomas Passin

unread,
Oct 3, 2022, 8:36:17 AM10/3/22
to leo-editor
This follows a very common convention.  A single-letter parameter on the command line takes a single dash, longer parameters take a double dash. E.g.,

-h
--help

Some programs don't quite follow the convention (java, for example, understands java -version) but Python and Leo do.

User User

unread,
Oct 3, 2022, 9:25:39 AM10/3/22
to leo-editor
Thank you very much! I used double dash and the installer worked successfully:
...
Successfully built leo
Installing collected packages: leo
  Attempting uninstall: leo
    Found existing installation: leo 6.6.4
    Uninstalling leo-6.6.4:
      Successfully uninstalled leo-6.6.4
  WARNING: The scripts leo-c.exe, leo-console.exe, leo-m.exe and leo-messages.exe are installed in 'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed leo-6.3


C:\Users\user\Apps\Leo\leo-editor-6.3>

However, my attempt to launch Leo is unsuccessful:
C:\Users\user>python C:\Users\user\Apps\Leo\leo-editor-6.3\launchLeo.py


** (python3.10.exe:8084): WARNING **: 15:22:23.005: Error loading plugin: 'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\enchant\data\mingw64/lib/enchant-2\enchant_hunspell.dll': The specified module could not be found.

Leo 6.3
Invalid language code for Enchant 'en-US'
Using "en_US" instead
Use @string enchant_language to specify your language
Can not create empty workbook
Traceback (most recent call last):

  File "C:\Users\user\Apps\Leo\leo-editor-6.3\leo\commands\spellCommands.py", line 353, in open_dict_file
    d = enchant.DictWithPWL(language, fn)

  File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\enchant\__init__.py", line 781, in __init__
    super().__init__(tag, broker)

  File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\enchant\__init__.py", line 542, in __init__
    super().__init__()

...

What else do I miss? It's hard to believe that Leo can't launch due to missing hunspell module.

Thank you once again!

Thomas Passin

unread,
Oct 3, 2022, 10:33:25 AM10/3/22
to leo-editor
I'm puzzled by the long, complicated paths being reported.  I've never seen paths like that, at least not on Windows computers.  A typical path on my system would be  

C:\Users\tom\AppData\Roaming\Python\Python310\site-packages\leo\core

None of those caches and strange numbers; none of that PythonSoftwareFoundation stuff.  Now, if you were installing, say,  the Anaconda python environment, it might be different, but you haven't said.

I'm also puzzled by your install message "Successfully built leo".  A normal install on Windows wouldn't build it.  It would install a pre-built package.

You can find out where Leo is located in your file system like this:

py -c "import leo; print(leo.__file__)"

instead of "py", use whatever command you normally use to launch Python, like "python3" or whatever it is.  On my Windows system, the result is

C:\Users\tom\AppData\Roaming\Python\Python310\site-packages\leo\__init__.py

As for the enchant package, I wouldn't have thought that Leo wouldn't run without it.  Leo's code that tries to import it and to use it isn't active if the enchant package can't be imported.  In fact, it looks like the enchant module exists but in a weird way.  The message

'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\enchant\data\mingw64/lib/enchant-2\enchant_hunspell.dll': The specified module could not be found.

has an impossible path (one with some forward slashes), and the fact that it was built with the mingw compiler system is very non-standard for a normal Windows install.  It again makes me think that you installed using some environment like Anaconda or some such, and the installer got confused by a mixture of Windows and Linux paths.

I suggest that you try installing Python and then Leo directly from a Windows console - assuming that you are really on Windows, as indicated by the path "C:\Users\user\AppData\Local\Packages".  BTW, an ordinary Python install gets located into "C:\Users\user\AppData\Local\Programs", again showing that there is something non-standard about your install.  Download the Windows Python3 installer from python.org.  Run it - don't use Anaconda or any other pre-packaged environment for Python - just double-click on its icon.  When that is finished, run it and check to make sure you are actually running the newly installed version.  The install should have installed a launcher that you can invoke by just typing "py" in a Windows console windows (i.e., a cmd.exe window).

Once that has been done, install Leo using pip.  I suggest installing the latest version.  You should make sure you are using the pip program that belongs to your newly-installed python, and the best way to do that is to run it as a module:

py -m pip install leo

Again, if "py" isn't the right command to launch the newly installed Python executable, type the right command name instead.

You can check to see if the newly installed python package uses the standard Windows system paths:

py -c "import sys; print('\n'.join(sys.path))"

You should see something much like this:

C:\Users\tom\AppData\Local\Programs\Python\Python310\python310.zip
C:\Users\tom\AppData\Local\Programs\Python\Python310\DLLs
C:\Users\tom\AppData\Local\Programs\Python\Python310\lib
C:\Users\tom\AppData\Local\Programs\Python\Python310
C:\Users\tom\AppData\Roaming\Python\Python310\site-packages
C:\Users\tom\AppData\Local\Programs\Python\Python310\lib\site-packages
C:\Users\tom\AppData\Local\Programs\Python\Python310\lib\site-packages\win32
C:\Users\tom\AppData\Local\Programs\Python\Python310\lib\site-packages\win32\lib
C:\Users\tom\AppData\Local\Programs\Python\Python310\lib\site-packages\Pythonwin


Notice that these paths are much shorter and simpler than the paths reported in the error messages from your previous attempt, and they are mostly in "C:\Users\tom\AppData\Local\Programs", not "C:\Users\tom\AppData\Local\Packages".

Once installed, make sure to run the version of Leo that you just installed and not some other.  This is important because your earlier attempts might have left a path that would launch some other version.  The easiest way to make sure is:

py -m leo.core.runLeo

If this new install seems to work right, you can think again about whether you want to try to use whatever other environment is on your system (Anaconda or whatever).  You probably won't need it.

User User

unread,
Oct 7, 2022, 8:43:22 AM10/7/22
to leo-editor
Hello, many thanks for your kind support and great advice!

I removed my old Python installation, downloaded a new one from python.org, installed it (and selected something like install paths in the install dialog), the paths were the same as you indicated. I used the command you provided to install Leo:  py -m pip install leo, the install process was successful. And yes, I'm able to run it with  py -m leo.core.runLeo command.

I created a shortcut with this command, Leo starts in Windows, the only drawback is that it opens a Terminal window which I don't need but this is a minor stuff. This is a Windows 10 system, I selected Run: Minimized in the shortcut properties.

You made my day, Leo is an important tool for me.

Thank you once again! Your help makes difference!

Thomas Passin

unread,
Oct 7, 2022, 9:39:23 AM10/7/22
to leo-editor
I'm glad I could help : ).  BTW, you can get your shortcut to run Leo without opening a console window by adding ("pyw", "python3w", etc.) before  Leo's executable path in the shortcut's Target field. The pythonw  program starts a Python program without displaying a window, so just find out what the right command is for your system.  With a new Python install, pyw should work.  Or if not, you can used the full path to pythonw in the Target field. On my system, e.g. this string in the Target field will launch Leo:

C:\Users\tom\AppData\Local\Programs\Python\Python310\pythonw.exe -m leo.core.runLeo

One reason to run Leo using a console window:  you can see any error messages.

User User

unread,
Oct 7, 2022, 10:28:35 AM10/7/22
to leo-editor
Yes, it worked! I'm able to launch Leo without a terminal window with pyw.exe
Many thanks once again! Have a great day!
Reply all
Reply to author
Forward
0 new messages