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
On Tuesday, May 14, 2024 at 1:15:19 PM UTC-4 [email protected] wrote:
Hello Thomas,
[email protected] 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
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/bb51d954-6d9b-4533-955f-ca23e82739fdn%40googlegroups.com.