Leo from GitHub in a PyVE on Debian ?

119 views
Skip to first unread message

Viktor Ransmayr

unread,
May 14, 2024, 8:54:38 AM5/14/24
to leo-editor
Hello everyone,

Today I have started again to check out the status of Leo (devel branch) from GitHub within a Debian 12 VM.

I believe that I did follow the (new) recommended steps for Leo, i.e.:

* Created a new PyVE for Leo from GitHub - OK - See "Log-001".
* Installed Leo from GitHub from scratch - Not OK - See "Log-002".

Has anybody else tried such a setup - and / or - does anyone of you have an explanation what is going wrong / what I'm missing ?

If I try the same in a similar environment, with Leo using pip from PyPI, I get the following status, which I'd have expected in a similar fashion also for the setup from GitHub - See "Log-003".

Thanks a lot for any kind of feedback !

With kind regards,

Viktor

### Log-001

    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ cd PyVE/GitHub/
    user@debian-leo-study-vm:~/PyVE/GitHub$
    user@debian-leo-study-vm:~/PyVE/GitHub$ rm -rf Leo
    user@debian-leo-study-vm:~/PyVE/GitHub$
    user@debian-leo-study-vm:~/PyVE/GitHub$ python3 -m venv Leo
    user@debian-leo-study-vm:~/PyVE/GitHub$
    user@debian-leo-study-vm:~/PyVE/GitHub$ cd Leo/
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$

### Log-002

    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ git clone https://github.com/leo-editor/leo-editor.git
    Cloning into 'leo-editor'...
    remote: Enumerating objects: 232512, done.
    remote: Counting objects: 100% (848/848), done.
    remote: Compressing objects: 100% (241/241), done.
    remote: Total 232512 (delta 625), reused 783 (delta 607), pack-reused 231664
    Receiving objects: 100% (232512/232512), 237.68 MiB | 3.88 MiB/s, done.
    Resolving deltas: 100% (184943/184943), done.
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ git branch
    * devel
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m pip list
    Package    Version
    ---------- -------
    pip        23.0.1
    setuptools 66.1.1
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m pip install -r requirements.txt
    Ignoring Send2Trash: markers 'platform_system == "Windows"' don't match your environment
    Ignoring windows-curses: markers 'platform_system == "Windows"' don't match your environment
    Collecting mypy
      Using cached mypy-1.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.6 MB)
    Collecting mypy-extensions
      Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
    Collecting ruff
      Using cached ruff-0.4.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB)
    Collecting typing_extensions
      Using cached typing_extensions-4.11.0-py3-none-any.whl (34 kB)
    Collecting types-docutils
      Using cached types_docutils-0.21.0.20240423-py3-none-any.whl (27 kB)
    Collecting types-Markdown
      Using cached types_Markdown-3.6.0.20240316-py3-none-any.whl (18 kB)
    Collecting types-paramiko
      Using cached types_paramiko-3.4.0.20240423-py3-none-any.whl (33 kB)
    Collecting types-PyYAML
      Using cached types_PyYAML-6.0.12.20240311-py3-none-any.whl (15 kB)
    Collecting types-requests
      Using cached types_requests-2.31.0.20240406-py3-none-any.whl (15 kB)
    Collecting types-six
      Using cached types_six-1.16.21.20240513-py3-none-any.whl (15 kB)
    Collecting asttokens
      Using cached asttokens-2.4.1-py2.py3-none-any.whl (27 kB)
    Collecting beautifulsoup4
      Using cached beautifulsoup4-4.12.3-py3-none-any.whl (147 kB)
    Collecting black
      Using cached black-24.4.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB)
    Collecting docutils
      Using cached docutils-0.21.2-py3-none-any.whl (587 kB)
    Collecting flexx
      Using cached flexx-0.8.4-py2.py3-none-any.whl (351 kB)
    Collecting markdown
      Using cached Markdown-3.6-py3-none-any.whl (105 kB)
    Collecting matplotlib
      Using cached matplotlib-3.8.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.6 MB)
    Collecting meta
      Using cached meta-1.0.2-py3-none-any.whl
    Collecting numpy
      Using cached numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
    Collecting pyenchant
      Using cached pyenchant-3.2.2-py3-none-any.whl (55 kB)
    Collecting pyflakes
      Using cached pyflakes-3.2.0-py2.py3-none-any.whl (62 kB)
    Collecting pytest
      Using cached pytest-8.2.0-py3-none-any.whl (339 kB)
    Collecting pytest-cov
      Using cached pytest_cov-5.0.0-py3-none-any.whl (21 kB)
    Collecting sphinx
      Using cached sphinx-7.3.7-py3-none-any.whl (3.3 MB)
    Collecting tk
      Using cached tk-0.1.0-py3-none-any.whl (3.9 kB)
    Collecting urllib3
      Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
    Collecting PyQt6>=6.6
      Using cached PyQt6-6.7.0-cp38-abi3-manylinux_2_28_x86_64.whl (7.9 MB)
    Collecting PyQt6-QScintilla
      Using cached PyQt6_QScintilla-2.14.1-cp37-abi3-manylinux_2_28_x86_64.whl (2.8 MB)
    Collecting PyQt6-WebEngine
      Using cached PyQt6_WebEngine-6.7.0-cp38-abi3-manylinux_2_28_x86_64.whl (268 kB)
    Collecting cryptography>=37.0.0
      Using cached cryptography-42.0.7-cp39-abi3-manylinux_2_28_x86_64.whl (3.8 MB)
    Collecting six>=1.12.0
      Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
    Collecting soupsieve>1.2
      Using cached soupsieve-2.5-py3-none-any.whl (36 kB)
    Collecting click>=8.0.0
      Using cached click-8.1.7-py3-none-any.whl (97 kB)
    Collecting packaging>=22.0
      Using cached packaging-24.0-py3-none-any.whl (53 kB)
    Collecting pathspec>=0.9.0
      Using cached pathspec-0.12.1-py3-none-any.whl (31 kB)
    Collecting platformdirs>=2
      Using cached platformdirs-4.2.1-py3-none-any.whl (17 kB)
    Collecting tornado
      Using cached tornado-6.4-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (435 kB)
    Collecting pscript>=0.7.7
      Using cached pscript-0.7.7-py3-none-any.whl (126 kB)
    Collecting webruntime>=0.5.6
      Using cached webruntime-0.5.8-py3-none-any.whl (53 kB)
    Collecting dialite>=0.5.2
      Using cached dialite-0.5.3-py3-none-any.whl (8.8 kB)
    Collecting contourpy>=1.0.1
      Using cached contourpy-1.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (306 kB)
    Collecting cycler>=0.10
      Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
    Collecting fonttools>=4.22.0
      Using cached fonttools-4.51.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB)
    Collecting kiwisolver>=1.3.1
      Using cached kiwisolver-1.4.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
    Collecting pillow>=8
      Using cached pillow-10.3.0-cp311-cp311-manylinux_2_28_x86_64.whl (4.5 MB)
    Collecting pyparsing>=2.3.1
      Using cached pyparsing-3.1.2-py3-none-any.whl (103 kB)
    Collecting python-dateutil>=2.7
      Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
    Collecting iniconfig
      Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB)
    Collecting pluggy<2.0,>=1.5
      Using cached pluggy-1.5.0-py3-none-any.whl (20 kB)
    Collecting coverage[toml]>=5.2.1
      Using cached coverage-7.5.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (235 kB)
    Collecting sphinxcontrib-applehelp
      Using cached sphinxcontrib_applehelp-1.0.8-py3-none-any.whl (120 kB)
    Collecting sphinxcontrib-devhelp
      Using cached sphinxcontrib_devhelp-1.0.6-py3-none-any.whl (83 kB)
    Collecting sphinxcontrib-jsmath
      Using cached sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB)
    Collecting sphinxcontrib-htmlhelp>=2.0.0
      Using cached sphinxcontrib_htmlhelp-2.0.5-py3-none-any.whl (99 kB)
    Collecting sphinxcontrib-serializinghtml>=1.1.9
      Using cached sphinxcontrib_serializinghtml-1.1.10-py3-none-any.whl (92 kB)
    Collecting sphinxcontrib-qthelp
      Using cached sphinxcontrib_qthelp-1.0.7-py3-none-any.whl (89 kB)
    Collecting Jinja2>=3.0
      Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
    Collecting Pygments>=2.14
      Using cached pygments-2.18.0-py3-none-any.whl (1.2 MB)
    Collecting snowballstemmer>=2.0
      Using cached snowballstemmer-2.2.0-py2.py3-none-any.whl (93 kB)
    Collecting babel>=2.9
      Using cached Babel-2.15.0-py3-none-any.whl (9.6 MB)
    Collecting alabaster~=0.7.14
      Using cached alabaster-0.7.16-py3-none-any.whl (13 kB)
    Collecting imagesize>=1.3
      Using cached imagesize-1.4.1-py2.py3-none-any.whl (8.8 kB)
    Collecting requests>=2.25.0
      Using cached requests-2.31.0-py3-none-any.whl (62 kB)
    Collecting PyQt6-sip<14,>=13.6
      Using cached PyQt6_sip-13.6.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl (308 kB)
    Collecting PyQt6-Qt6<6.8.0,>=6.7.0
      Using cached PyQt6_Qt6-6.7.0-py3-none-manylinux_2_28_x86_64.whl (74.0 MB)
    Collecting PyQt6-WebEngine-Qt6<6.8.0,>=6.7.0
      Using cached PyQt6_WebEngine_Qt6-6.7.0-py3-none-manylinux_2_28_x86_64.whl (102.1 MB)
    Collecting cffi>=1.12
      Using cached cffi-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (464 kB)
    Collecting MarkupSafe>=2.0
      Using cached MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB)
    Collecting charset-normalizer<4,>=2
      Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
    Collecting idna<4,>=2.5
      Using cached idna-3.7-py3-none-any.whl (66 kB)
    Collecting certifi>=2017.4.17
      Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
    Collecting pycparser
      Using cached pycparser-2.22-py3-none-any.whl (117 kB)
    Installing collected packages: tk, snowballstemmer, PyQt6-WebEngine-Qt6, PyQt6-Qt6, pscript, meta, dialite, webruntime, urllib3, typing_extensions, types-six, types-PyYAML, types-Markdown, types-docutils, tornado, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, soupsieve, six, ruff, PyQt6-sip, pyparsing, Pygments, pyflakes, pyenchant, pycparser, pluggy, platformdirs, pillow, pathspec, packaging, numpy, mypy-extensions, MarkupSafe, markdown, kiwisolver, iniconfig, imagesize, idna, fonttools, docutils, cycler, coverage, click, charset-normalizer, certifi, babel, alabaster, types-requests, requests, python-dateutil, pytest, PyQt6, mypy, Jinja2, flexx, contourpy, cffi, black, beautifulsoup4, asttokens, sphinx, pytest-cov, PyQt6-WebEngine, PyQt6-QScintilla, matplotlib, cryptography, types-paramiko
    Successfully installed Jinja2-3.1.4 MarkupSafe-2.1.5 PyQt6-6.7.0 PyQt6-QScintilla-2.14.1 PyQt6-Qt6-6.7.0 PyQt6-WebEngine-6.7.0 PyQt6-WebEngine-Qt6-6.7.0 PyQt6-sip-13.6.0 Pygments-2.18.0 alabaster-0.7.16 asttokens-2.4.1 babel-2.15.0 beautifulsoup4-4.12.3 black-24.4.2 certifi-2024.2.2 cffi-1.16.0 charset-normalizer-3.3.2 click-8.1.7 contourpy-1.2.1 coverage-7.5.1 cryptography-42.0.7 cycler-0.12.1 dialite-0.5.3 docutils-0.21.2 flexx-0.8.4 fonttools-4.51.0 idna-3.7 imagesize-1.4.1 iniconfig-2.0.0 kiwisolver-1.4.5 markdown-3.6 matplotlib-3.8.4 meta-1.0.2 mypy-1.10.0 mypy-extensions-1.0.0 numpy-1.26.4 packaging-24.0 pathspec-0.12.1 pillow-10.3.0 platformdirs-4.2.1 pluggy-1.5.0 pscript-0.7.7 pycparser-2.22 pyenchant-3.2.2 pyflakes-3.2.0 pyparsing-3.1.2 pytest-8.2.0 pytest-cov-5.0.0 python-dateutil-2.9.0.post0 requests-2.31.0 ruff-0.4.4 six-1.16.0 snowballstemmer-2.2.0 soupsieve-2.5 sphinx-7.3.7 sphinxcontrib-applehelp-1.0.8 sphinxcontrib-devhelp-1.0.6 sphinxcontrib-htmlhelp-2.0.5 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.7 sphinxcontrib-serializinghtml-1.1.10 tk-0.1.0 tornado-6.4 types-Markdown-3.6.0.20240316 types-PyYAML-6.0.12.20240311 types-docutils-0.21.0.20240423 types-paramiko-3.4.0.20240423 types-requests-2.31.0.20240406 types-six-1.16.21.20240513 typing_extensions-4.11.0 urllib3-2.2.1 webruntime-0.5.8
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m pip list
    Package                       Version
    ----------------------------- ----------------
    alabaster                     0.7.16
    asttokens                     2.4.1
    Babel                         2.15.0
    beautifulsoup4                4.12.3
    black                         24.4.2
    certifi                       2024.2.2
    cffi                          1.16.0
    charset-normalizer            3.3.2
    click                         8.1.7
    contourpy                     1.2.1
    coverage                      7.5.1
    cryptography                  42.0.7
    cycler                        0.12.1
    dialite                       0.5.3
    docutils                      0.21.2
    flexx                         0.8.4
    fonttools                     4.51.0
    idna                          3.7
    imagesize                     1.4.1
    iniconfig                     2.0.0
    Jinja2                        3.1.4
    kiwisolver                    1.4.5
    Markdown                      3.6
    MarkupSafe                    2.1.5
    matplotlib                    3.8.4
    meta                          1.0.2
    mypy                          1.10.0
    mypy-extensions               1.0.0
    numpy                         1.26.4
    packaging                     24.0
    pathspec                      0.12.1
    pillow                        10.3.0
    pip                           23.0.1
    platformdirs                  4.2.1
    pluggy                        1.5.0
    pscript                       0.7.7
    pycparser                     2.22
    pyenchant                     3.2.2
    pyflakes                      3.2.0
    Pygments                      2.18.0
    pyparsing                     3.1.2
    PyQt6                         6.7.0
    PyQt6-QScintilla              2.14.1
    PyQt6-Qt6                     6.7.0
    PyQt6-sip                     13.6.0
    PyQt6-WebEngine               6.7.0
    PyQt6-WebEngine-Qt6           6.7.0
    pytest                        8.2.0
    pytest-cov                    5.0.0
    python-dateutil               2.9.0.post0
    requests                      2.31.0
    ruff                          0.4.4
    setuptools                    66.1.1
    six                           1.16.0
    snowballstemmer               2.2.0
    soupsieve                     2.5
    Sphinx                        7.3.7
    sphinxcontrib-applehelp       1.0.8
    sphinxcontrib-devhelp         1.0.6
    sphinxcontrib-htmlhelp        2.0.5
    sphinxcontrib-jsmath          1.0.1
    sphinxcontrib-qthelp          1.0.7
    sphinxcontrib-serializinghtml 1.1.10
    tk                            0.1.0
    tornado                       6.4
    types-docutils                0.21.0.20240423
    types-Markdown                3.6.0.20240316
    types-paramiko                3.4.0.20240423
    types-PyYAML                  6.0.12.20240311
    types-requests                2.31.0.20240406
    types-six                     1.16.21.20240513
    typing_extensions             4.11.0
    urllib3                       2.2.1
    webruntime                    0.5.8
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ cd ~
    (Leo) user@debian-leo-study-vm:~$
    (Leo) user@debian-leo-study-vm:~$ leo --version
    Leo 6.7.8
    Python 3.11.2
    linux
    (Leo) user@debian-leo-study-vm:~$
    (Leo) user@debian-leo-study-vm:~$ which leo
    /home/user/.local/bin/leo
    (Leo) user@debian-leo-study-vm:~$


### Log-003

(Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$
(Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ leo --version
Leo 6.7.8
Python 3.11.2
linux
(Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$
(Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ which leo
/home/user/PyVE/PyPI/Leo/bin/leo
(Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$


Thomas Passin

unread,
May 14, 2024, 10:03:20 AM5/14/24
to leo-editor
I wonder whether you VE activation somehow got lost during this process.  I noticed this:

~$ which leo
/home/user/.local/bin/leo

This says that typing "leo" uses that script, which is not one in the VE.  Try this, and let us know what happens -

    First, activate your VE environment.  Then issue

    python3 -m leo.core.runLeo --version

You should get something like this:

Leo 6.7.9-devel, ekr-3892-vr-pane branch, build 8ede3fc77e
2024-05-14 05:12:23 -0500
Python 3.11.6
linux


I always run Leo that way, or with a script that uses the incantation.  You are guaranteed to run the version of Leo that goes along with that version of python3, and if you have activated the VE then Python's module search path will be within the VE.  Otherwise, you are at the mercy of the system, which may not have the same idea as you as to what to run.

I often create one desktop icon to run the ordinary release of Leo and another one to run from my git-clone directory.  I recommend that you do the same (or create two launch scripts and use them).

On Tuesday, May 14, 2024 at 8:54:38 AM UTC-4 viktor....@gmail.com wrote:
Hello everyone,

Today I have started again to check out the status of Leo (devel branch) from GitHub within a Debian 12 VM.

I believe that I did follow the (new) recommended steps for Leo, i.e.:

* Created a new PyVE for Leo from GitHub - OK - See "Log-001".
* Installed Leo from GitHub from scratch - Not OK - See "Log-002".

Has anybody else tried such a setup - and / or - does anyone of you have an explanation what is going wrong / what I'm missing ?

If I try the same in a similar environment, with Leo using pip from PyPI, I get the following status, which I'd have expected in a similar fashion also for the setup from GitHub - See "Log-003".

Thanks a lot for any kind of feedback !
[snip] 

Viktor Ransmayr

unread,
May 14, 2024, 1:15:19 PM5/14/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Dienstag, 14. Mai 2024 um 16:03:20 UTC+2:
I wonder whether you VE activation somehow got lost during this process.  I noticed this:

~$ which leo
/home/user/.local/bin/leo

This says that typing "leo" uses that script, which is not one in the VE.  Try this, and let us know what happens -

    First, activate your VE environment.  Then issue

    python3 -m leo.core.runLeo --version

You should get something like this:

Leo 6.7.9-devel, ekr-3892-vr-pane branch, build 8ede3fc77e
2024-05-14 05:12:23 -0500
Python 3.11.6
linux


Thanks a lot for your feedback ! - This is what the command returns in the first place:

user@debian-leo-study-vm:~$ cd PyVE/GitHub/Leo/

user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ python3 -m leo.core.runLeo --version
/home/user/PyVE/GitHub/Leo/bin/python3: Error while finding module specification for 'leo.core.runLeo' (ModuleNotFoundError: No module named 'leo')
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$

Only if I move a directory 'down' the command works:

(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m leo.core.runLeo --version
Leo 6.7.9-devel, devel branch, build fb85027eac
2024-05-13 16:10:23 -0500
Python 3.11.2
linux
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$

I guess some more ' reading' on my side is needed ...

With kind regards,

Viktor

Thomas Passin

unread,
May 14, 2024, 2:05:10 PM5/14/24
to leo-editor
It can be hard to be sure what the Python search path is.  Here is what shows up for my system when I have activated my "Leo" VE.  This VE (on Windows) is contained in the directory  C:\Tom\venvs\leo. Note that on Windows you don't have to source the script.

C:\Tom\venvs\leo>Scripts\activate

(leo) C:\Tom\venvs\leo>py -c "import sys;print('\n'.join(sys.path))

C:\Users\tom\AppData\Local\Programs\Python\Python312\python312.zip
C:\Users\tom\AppData\Local\Programs\Python\Python312\DLLs
C:\Users\tom\AppData\Local\Programs\Python\Python312\Lib
C:\Users\tom\AppData\Local\Programs\Python\Python312
C:\Tom\venvs\leo
C:\Tom\venvs\leo\Lib\site-packages
C:\Tom\venvs\leo\Lib\site-packages\win32
C:\Tom\venvs\leo\Lib\site-packages\win32\lib
C:\Tom\venvs\leo\Lib\site-packages\Pythonwin


This is for a pip-installed version of Leo, not one cloned from github.  Notice how Python will search its original installation path first, then the venv paths.  Anything that was installed into the system's Lib/sitepackages location will be found first.  Especially on Linux it's unlikely that Leo was installed there.

The script to launch Leo is in the Scripts directory.

(leo) C:\Tom\venvs\leo>dir Scripts |find "leo"
 Directory of C:\Tom\venvs\leo\Scripts
02/28/2024  09:20 AM           108,401 leo-c.exe
02/28/2024  09:20 AM           108,401 leo-console.exe
02/28/2024  09:20 AM           108,385 leo-m.exe
02/28/2024  09:20 AM           108,385 leo-messages.exe
02/28/2024  09:20 AM           102,242 leo.exe


Otherwise, for this venv, when you issue the command python3 -m leo.core.runLeo,  Python will look for a leo directory from top to bottom in the list of directory on sys.path.  It will get to C:\Tom\venvs\leo\Lib\site-package, and will find it there.

Sometimes, and this applies to Debian IIRC, the first time Leo is installed on a computer you might see an error message when you try to run it. The error message will say that "libxcb-cursor0" is needed (that's "cursorZero", in case the font zero looks like the letter O). You can install that library with the system package installer (e.g., apt-get),  But that may or may not be the right name to use for the library.  If the install attempt doesn't work, you can check at http://pkgs.org/ to find a better package name.

For running Leo with a clone of the Leo repo, I use a little script that sets the PYTHONPATH to the location of the cloned repo.  Here's my Linux script (the git clone is in ~/git/leo-editor):

(qt6) tom@thomas-xubuntu-VirtualBox:~/venv/qt6$ whereis py-leo-git
py-leo-git: /home/tom/.local/bin/py-leo-git
(qt6) tom@thomas-xubuntu-VirtualBox:~/venv/qt6$ cat /home/tom/.local/bin/py-leo-git
#! /usr/bin/bash
if [ "$PYTHONPATH" == "" ]; then
    export PYTHONPATH=~/git/leo-editor
    echo "Using PYTHONPATH:" $PYTHONPATH
else
    echo "PYTHONPATH already set to " $PYTHONPATH
fi

python3 -m leo.core.runLeo $*


Running this script from inside your activated venv will run Python using the copy of Leo that is located in the repo.

HTH

Thomas Passin

unread,
May 14, 2024, 2:09:14 PM5/14/24
to leo-editor
On Tuesday, May 14, 2024 at 2:05:10 PM UTC-4 Thomas Passin wrote:
The script to launch Leo is in the Scripts directory.

Of course, in Linux this will be the bin directory instead.

Thomas Passin

unread,
May 14, 2024, 2:40:34 PM5/14/24
to leo-editor
In case I didn't make it clear, I think a script like the one I showed above is an excellent way to launch the copy of Leo that is in your cloned repo.  That's because it works from anywhere and you don't need to remember any special locations or cd to them  If you are in an activated venv, it works and will use the venv version of the dependencies.  If you are not in a venv, it will use the system Leo installation and dependencies, if you've installed them there (I have - in the user site-packages directory, of course, not the system's).

Thomas Passin

unread,
May 14, 2024, 3:30:01 PM5/14/24
to leo-editor
I though it might be useful to pull together the steps to create on Linux a new virtual environment (venv) and install Leo's dependencies into it.  I created a new venv in the ~/venv/leo directory for this purpose:

tom@thomas-xubuntu-VirtualBox:~/venv$ mkdir leo
tom@thomas-xubuntu-VirtualBox:~/venv$ python3 -m venv leo
tom@thomas-xubuntu-VirtualBox:~/venv$ source ./leo/bin/activate
(leo) tom@thomas-xubuntu-VirtualBox:~/venv$ python3 -m pip install -r ~/git/leo-editor/requirements.txt 
  tom@thomas-xubuntu-VirtualBox:~/venv$

Viktor Ransmayr

unread,
May 15, 2024, 6:22:34 AM5/15/24
to leo-editor
Hello Thomas,

Thanks a lot for all the feedback & input you provided ! - I will read them one by one ...

tbp1...@gmail.com schrieb am Dienstag, 14. Mai 2024 um 20:05:10 UTC+2:
It can be hard to be sure what the Python search path is.  Here is what shows up for my system when I have activated my "Leo" VE.  This VE (on Windows) is contained in the directory  C:\Tom\venvs\leo. Note that on Windows you don't have to source the script.

Please bear with me a bit longer, as I'm sometimes stubborn ;-)

I'd like to understand, why the case of 'Leo from GitHub in a PyVE' is no longer working ?  - It has worked on Linux (Debian & Fedora) up until Leo version 6.7.7 (maybe evern 6.7.8) !

I'd like to do that, before creating an **additional personal** script, since I still believe it should be part of Leo's GitHub repository ...

I did use your advice to check  Python's search path, etc. - Here are the results for the three relevant cases in my Debian 12 VM:

* Check out Python's search path with Leo outside of any PyVE - See "Log-001".
* Check out search path in Leo's PyVE from PyPI - See "Log-002".
* Check out search path in Leo's PyVE from GitHub - See "Log-003".

Note 1: The first variation is necessary for me to address Leo-Integ issue # 299.

Note 2: The answer to my question has to do with the fact that no 'leo' module is found in '/home/user/PyVE/GitHub/Leo/bin'  - See "Log-003" ...

With kind regards,

Viktor

### Log-001

    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ python3 -c "import sys;print('\n'.join(sys.path))"

    /usr/lib/python311.zip
    /usr/lib/python3.11
    /usr/lib/python3.11/lib-dynload
    /home/user/.local/lib/python3.11/site-packages
    /usr/lib/python3/dist-packages
    /usr/lib/python3.11/dist-packages
    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ python3 -m leo.core.runLeo --version
    Leo 6.7.8
    Python 3.11.2
    linux

    user@debian-leo-study-vm:~$ which leo
    /home/user/.local/bin/leo
    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ echo $PATH
    /home/user/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    user@debian-leo-study-vm:~$

### Log-002

    user@debian-leo-study-vm:~$ cd PyVE/PyPI/Leo/
    user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ source bin/activate
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ python3 -c "import sys;print('\n'.join(sys.path))"

    /usr/lib/python311.zip
    /usr/lib/python3.11
    /usr/lib/python3.11/lib-dynload
    /home/user/PyVE/PyPI/Leo/lib/python3.11/site-packages
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ python3 -m leo.core.runLeo --version
    Leo 6.7.8
    Python 3.11.2
    linux

    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ which leo
    /home/user/PyVE/PyPI/Leo/bin/leo
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$ echo $PATH
    /home/user/PyVE/PyPI/Leo/bin:/home/user/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    (Leo) user@debian-leo-study-vm:~/PyVE/PyPI/Leo$

### Log-003

    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ cd PyVE/GitHub/Leo
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ python3 -c "import sys;print('\n'.join(sys.path))"

    /usr/lib/python311.zip
    /usr/lib/python3.11
    /usr/lib/python3.11/lib-dynload
    /home/user/PyVE/GitHub/Leo/lib/python3.11/site-packages

    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ python3 -m leo.core.runLeo --version
    /home/user/PyVE/GitHub/Leo/bin/python3: Error while finding module specification for 'leo.core.runLeo' (ModuleNotFoundError: No module named 'leo')
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ which leo
    /home/user/.local/bin/leo

    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m leo.core.runLeo --version
    Leo 6.7.9-devel, devel branch, build fb85027eac
    2024-05-13 16:10:23 -0500
    Python 3.11.2
    linux
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ which leo
    /home/user/.local/bin/leo
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ echo $PATH
    /home/user/PyVE/GitHub/Leo/bin:/home/user/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$

Thomas Passin

unread,
May 15, 2024, 9:28:39 AM5/15/24
to leo-editor
It's hard for me to know what you want to convey with these long transcripts.  It would be better if they were edited, or at least if you would point out results that you don't like or don't understand.  But I can see a few things, I think:

1. Installing Leo's dependencies using pip -r requirements.txt does not install Leo itself.  It does not create those scripts in the venv's bin directory.  It only installs the modules and packages that Leo needs.  You have to install Leo using pip for that (while the venv is active).  For example, in my "leo" venv, which has Leo's dependencies but into which I haven't installed leo using pip, there is no leo script:

(leo) tom@thomas-xubuntu-VirtualBox:~/venv$ ls leo/bin/ |grep "leo"
# there was no result

2. Using python3 -m leo.core.runLeo, when you have cd'ed to your github's leo-editor directory, finds Leo's files because Python starts looking for files starting at the current directory.  If you export the PYTHONPATH shell variable, then Python will start by looking there.  That's why I recommend using a script that sets the variable.  Then you don't have to remember to cd to the right directory first.

3. Even after you have activated your venv, the shell will not find its leo script because there isn't one. It won't be there unless you pip-install Leo while the venv is activated. The results from running which show that.  You could also use whereis, and get the same result.  Even if you installed Leo in the venv and started Leo using the venv's leo script, Leo would be using the Leo code in the venv, not the code in your github repo.

4. Your transcript shows that Leo started when you had cd'ed to its repo directory.  But I can only see Leo's startup output to the console. That output looks normal.  But it doesn't tell me if the Leo window actually opened and worked.  Did it?

HTH

Viktor Ransmayr

unread,
May 15, 2024, 2:33:08 PM5/15/24
to leo-e...@googlegroups.com
Hello Thomas,

Am Mi., 15. Mai 2024 um 15:28 Uhr schrieb Thomas Passin <tbp1...@gmail.com>:
It's hard for me to know what you want to convey with these long transcripts. 

I'm sorry !

I just realized right now , that Gmail did not keep' my selection of "Courier New" for all parts of the logs.
 
It would be better if they were edited, or at least if you would point out results that you don't like or don't understand.

Again sorry, if my msg / point was not clear enough - but - I thought I had state it ...

"""
I'd like to understand, why the case of 'Leo from GitHub in a PyVE' is no longer working ?  - It has worked on Linux (Debian & Fedora) up until Leo version 6.7.7 (maybe evern 6.7.8) !
"""
 
But I can see a few things, I think:

1. Installing Leo's dependencies using pip -r requirements.txt does not install Leo itself.  It does not create those scripts in the venv's bin directory.  It only installs the modules and packages that Leo needs.  You have to install Leo using pip for that (while the venv is active).  For example, in my "leo" venv, which has Leo's dependencies but into which I haven't installed leo using pip, there is no leo script:

(leo) tom@thomas-xubuntu-VirtualBox:~/venv$ ls leo/bin/ |grep "leo"
# there was no result

Yes, that confirms, what I stated in my logs as well.
 
2. Using python3 -m leo.core.runLeo, when you have cd'ed to your github's leo-editor directory, finds Leo's files because Python starts looking for files starting at the current directory.  If you export the PYTHONPATH shell variable, then Python will start by looking there.  That's why I recommend using a script that sets the variable.  Then you don't have to remember to cd to the right directory first.

Thanks, that was new / unkown to me - and - explains what I reported in the previous "Log-003".
 
3. Even after you have activated your venv, the shell will not find its leo script because there isn't one. It won't be there unless you pip-install Leo while the venv is activated. The results from running which show that.  You could also use whereis, and get the same result.  Even if you installed Leo in the venv and started Leo using the venv's leo script, Leo would be using the Leo code in the venv, not the code in your github repo.

Could / should Leo's documentation be improved ? - I did exactly what it says [1] now.
 
4. Your transcript shows that Leo started when you had cd'ed to its repo directory.  But I can only see Leo's startup output to the console. That output looks normal.  But it doesn't tell me if the Leo window actually opened and worked.  Did it?

No !

If I move down into "~/PyVE/GitHub/Leo/leo-editor"  - and - try to 'really' run Leo, it fails with the following traceback - See "Log-001".

With kind regards,

Viktor

---

 
### Log-001

user@debian-leo-study-vm:~$ cd PyVE/GitHub/Leo/

user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m leo.core.runLeo &
[1] 878
(Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ setting leoID from os.getenv('USER'): 'user'

Leo 6.7.9-devel, devel branch, build fb85027eac
2024-05-13 16:10:23 -0500
Python 3.11.2, PyQt version 6.7.0
linux
Can not load session
Traceback (most recent call last):

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 2307, in doPostPluginsInit
    g.app.sessionManager.load_session(c1, aList)

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoSessions.py", line 72, in load_session
    g.openWithFileName(fn, gui=g.app.gui, old_c=c)

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoGlobals.py", line 3238, in openWithFileName
    return g.app.loadManager.openWithFileName(fileName, gui, old_c)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 3010, in openWithFileName
    return lm.openExistingLeoFile(file_name, gui, old_c)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 3209, in openExistingLeoFile
    c = g.app.newCommander(
        ^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 1516, in newCommander
    c = leoCommands.Commands(fileName,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoCommands.py", line 165, in __init__
    c.finishCreate()  # Slightly slow.
    ^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoCommands.py", line 467, in finishCreate
    c.frame.log.finishCreate()

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/qt_frame.py", line 2598, in finishCreate
    c.spellCommands.openSpellTab()

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 443, in openSpellTab
    self.handler = SpellTabHandler(c, tabName)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 675, in __init__
    self.spellController = DefaultWrapper(c)  # type:ignore
                           ^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 185, in __init__
    g.app.spellDict = DefaultDict().d  # 2024/04/09: bug fix.
                      ^^^^^^^^^^^^^^^

AttributeError: 'DefaultDict' object has no attribute 'd'

Can not create workbook
Traceback (most recent call last):

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 2321, in doPostPluginsInit
    c1 = lm.openWorkBook()
         ^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 2365, in openWorkBook
    c = g.openWithFileName(fn, gui=g.app.gui, old_c=None)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoGlobals.py", line 3238, in openWithFileName
    return g.app.loadManager.openWithFileName(fileName, gui, old_c)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 3012, in openWithFileName
    return lm.openEmptyLeoFile(file_name, gui, old_c)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 3167, in openEmptyLeoFile
    c = g.app.newCommander(
        ^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoApp.py", line 1516, in newCommander
    c = leoCommands.Commands(fileName,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoCommands.py", line 165, in __init__
    c.finishCreate()  # Slightly slow.
    ^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/core/leoCommands.py", line 467, in finishCreate
    c.frame.log.finishCreate()

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/qt_frame.py", line 2598, in finishCreate
    c.spellCommands.openSpellTab()

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 443, in openSpellTab
    self.handler = SpellTabHandler(c, tabName)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 675, in __init__
    self.spellController = DefaultWrapper(c)  # type:ignore
                           ^^^^^^^^^^^^^^^^^

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 185, in __init__
    g.app.spellDict = DefaultDict().d  # 2024/04/09: bug fix.
                      ^^^^^^^^^^^^^^^

AttributeError: 'DefaultDict' object has no attribute 'd'


Thomas Passin

unread,
May 15, 2024, 2:57:02 PM5/15/24
to leo-editor
On Wednesday, May 15, 2024 at 2:33:08 PM UTC-4 viktor....@gmail.com wrote:
Hello Thomas,
[snip]

  File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 185, in __init__
    g.app.spellDict = DefaultDict().d  # 2024/04/09: bug fix.
                      ^^^^^^^^^^^^^^^

AttributeError: 'DefaultDict' object has no attribute 'd'

Funny, that looks like a bug in the devel branch that was fixed already. 

Strange, but the version of the devel branch you are running is not the current one, and I can't even find yours on Github.  The current commit is eef303a2d0fc1e41634376058fa5ace2ac9fad95.  Try updating your clone, or downloading a zip of the current version of the devel branch and using that one.

Viktor Ransmayr

unread,
May 15, 2024, 3:16:23 PM5/15/24
to leo-editor
Hello Thomas,

I did what you said - but - no change : -( - See log !

I'll call it a day for now - and - will restart tomorrow morning ...

With kind regards,

Viktor

### New Log

     user@debian-leo-study-vm:~$ cd PyVE/GitHub/Leo/
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ git branch
    * devel
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ git pull
    remote: Enumerating objects: 88, done.
    remote: Counting objects: 100% (76/76), done.
    remote: Compressing objects: 100% (19/19), done.
    remote: Total 50 (delta 44), reused 37 (delta 31), pack-reused 0
    Unpacking objects: 100% (50/50), 5.44 KiB | 67.00 KiB/s, done.
    From https://github.com/leo-editor/leo-editor
       fb85027ea..eef303a2d  devel                -> origin/devel
       18f9164ec..01d9dda87  ekr-3871-search-settings -> origin/ekr-3871-search-settings
     * [new branch]          ekr-3910-no-fl-ns-plugins -> origin/ekr-3910-no-fl-ns-plugins
     * [new branch]          ekr-3912-MacOs-crash -> origin/ekr-3912-MacOs-crash
       fb85027ea..eef303a2d  gh-pages             -> origin/gh-pages
    Updating fb85027ea..eef303a2d
    Fast-forward
     leo/config/leoSettings.leo     |   2 +-
     leo/core/leoCache.py           |  28 +-
     leo/core/leoFileCommands.py    |   4 -
     leo/core/leoFrame.py           |   4 +-
     leo/core/leoTokens.py          |  11 +-
     leo/doc/leoAttic.txt           | 115 ++++++
     leo/plugins/free_layout.py     |  33 +-
     leo/plugins/nested_splitter.py |   8 +-
     leo/plugins/qt_frame.py        |   2 +-
     leo/plugins/viewrendered.py    | 837 +++++++++++++++++++----------------------
     10 files changed, 550 insertions(+), 494 deletions(-)
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m leo.core.runLeo --version
    Leo 6.7.9-devel, devel branch, build eef303a2d0
    2024-05-14 07:59:14 -0500
    Python 3.11.2
    linux

    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python3 -m leo.core.runLeo
    setting leoID from os.getenv('USER'): 'user'
    Leo 6.7.9-devel, devel branch, build eef303a2d0
    2024-05-14 07:59:14 -0500
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 185, in __init__
        g.app.spellDict = DefaultDict().d  # 2024/04/09: bug fix.
                          ^^^^^^^^^^^^^^^

    AttributeError: 'DefaultDict' object has no attribute 'd'

      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/commands/spellCommands.py", line 185, in __init__
        g.app.spellDict = DefaultDict().d  # 2024/04/09: bug fix.
                          ^^^^^^^^^^^^^^^

    AttributeError: 'DefaultDict' object has no attribute 'd'

    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$


Thomas Passin

unread,
May 15, 2024, 5:34:11 PM5/15/24
to leo-editor
On my system, this version has the same line, but the line isn't getting called at startup.  Looking at the code that creates a DefaultDict, I don't see that it should have an attribute "d".  I suspect that the line should be

g.app.spellDict = DefaultDict()  # 2024/04/09: bug fix.

I can't test that because it's not getting called on my system.  I'm surprised that this failure can keep Leo from operating...

Thomas Passin

unread,
May 15, 2024, 6:33:36 PM5/15/24
to leo-editor
I'm getting a better idea of what may be going on.  Leo's spell checker tries to load the pyenchant module (which contains a speller and some word dictionaries). If that is not available, then the code branches to the code with the bug.  On Linux, in this condition, Leo did open its GUI window but it was very small.  When I expanded it an empty outline was displayed, although it was called "workbook".

When I fixed the bug by deleting the ".d", and made sure that enchant was not available, then Leo opened normally, although it did not have a spell-checking tab, which makes sense.

Perhaps pyenchant is not available for the Mac Python distribution?  It can be checked for by by activating your venv and issuing the command

python3 -m pip list |grep "pyenchant".

If it's listed then open a Python interpreter session and try to import it:

import enchant  # Not a typo - right name is "enchant", not "pyenchant"

If it's not there, you can search on line to see if it can be obtained for the Mac.  In the meantime you can get Leo working right by finding the python file named in the error message, finding that line, and deleting the characters ".d".  Save the file.  Leo should then run correctly.

Thomas Passin

unread,
May 15, 2024, 6:52:48 PM5/15/24
to leo-editor
I just created a PR to fix this bug.

Thomas Passin

unread,
May 15, 2024, 9:30:52 PM5/15/24
to leo-editor
The PR has been merged into the devel branch.  Update your clone repo and you should be good to go.

There is a possibility that on some Linux systems you have to install  python3-enchant using operating system installer.  Debian is one of them, I think.  So (untested) on debian-based distros:

sudo apt-get install python3-enchant

The reason is that on Windows the binary files needed are included in the PyPi install of pyenchant, but on Linux you have to install a system .so library and get it hooked up to the Python code.  The system's package does all that.  There's probably something similar for non-Debian-based distros.

Viktor Ransmayr

unread,
May 16, 2024, 5:24:27 AM5/16/24
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Donnerstag, 16. Mai 2024 um 03:30:52 UTC+2:
The PR has been merged into the devel branch.  Update your clone repo and you should be good to go.
 
Thanks a lot, your PR has resolved the issue !
 
There is a possibility that on some Linux systems you have to install  python3-enchant using operating system installer.  Debian is one of them, I think.  So (untested) on debian-based distros:

sudo apt-get install python3-enchant

This was not necessary for my PyVE of Leo's GitHub version ...
 
The reason is that on Windows the binary files needed are included in the PyPi install of pyenchant, but on Linux you have to install a system .so library and get it hooked up to the Python code.  The system's package does all that.  There's probably something similar for non-Debian-based distros.
On Wednesday, May 15, 2024 at 6:52:48 PM UTC-4 Thomas Passin wrote:
I just created a PR to fix this bug.

On Wednesday, May 15, 2024 at 6:33:36 PM UTC-4 Thomas Passin wrote:
I'm getting a better idea of what may be going on.  Leo's spell checker tries to load the pyenchant module (which contains a speller and some word dictionaries). If that is not available, then the code branches to the code with the bug.  On Linux, in this condition, Leo did open its GUI window but it was very small.  When I expanded it an empty outline was displayed, although it was called "workbook".

When I fixed the bug by deleting the ".d", and made sure that enchant was not available, then Leo opened normally, although it did not have a spell-checking tab, which makes sense.

Perhaps pyenchant is not available for the Mac Python distribution?  It can be checked for by by activating your venv and issuing the command

python3 -m pip list |grep "pyenchant".

It was already available - See log below:

    user@debian-leo-study-vm:~$
    user@debian-leo-study-vm:~$ cd PyVE/GitHub/Leo/
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ source bin/activate
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ python3 -m pip list | grep "pyenchant"
    pyenchant                     3.2.2
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$


I double-checked WHY - and - found out that it is part of Leo's required packages - See

 
If it's listed then open a Python interpreter session and try to import it:

import enchant  # Not a typo - right name is "enchant", not "pyenchant"

If it's not there, you can search on line to see if it can be obtained for the Mac.  In the meantime you can get Leo working right by finding the python file named in the error message, finding that line, and deleting the characters ".d".  Save the file.  Leo should then run correctly.


On Wednesday, May 15, 2024 at 5:34:11 PM UTC-4 Thomas Passin wrote:


AttributeError: 'DefaultDict' object has no attribute 'd'

Funny, that looks like a bug in the devel branch that was fixed already. 

Once again : Thanks a lot for resolving this issue !

With kind regards,

Viktor
 

Thomas Passin

unread,
May 16, 2024, 9:58:46 AM5/16/24
to leo-editor
On Thursday, May 16, 2024 at 5:24:27 AM UTC-4 viktor....@gmail.com wrote:
Hello Thomas,

tbp1...@gmail.com schrieb am Donnerstag, 16. Mai 2024 um 03:30:52 UTC+2:
The PR has been merged into the devel branch.  Update your clone repo and you should be good to go.
 
Thanks a lot, your PR has resolved the issue !

I double-checked WHY [pychant was present]- and - found out that it is part of Leo's required packages - See


Yes, that's right.  What I *think* I remember is that on some systems pyenchant wouldn't work when installed with pip.  In those cases, installing the system's package (e.g., python3-enchant) solved the problem.
 
Once again : Thanks a lot for resolving this issue !

: ) 
Reply all
Reply to author
Forward
0 new messages