My initial experience using ILeo ...

157 views
Skip to first unread message

Viktor Ransmayr

unread,
Jun 23, 2019, 5:32:02 AM6/23/19
to leo-editor
Hello Edward & Community,

Since I'm still waiting for feedback on the two other topics I raised here earlier, I spent some time this morning to investigate Leo’s IPython Bridge.

I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(

Is anybody else experiencing the same issue - or - can you tell me what I'm doing wrong / what I should change? - TIA!

With kind regards,

Viktor

###

Here are the notes from my investigations this morning:

  1. Create a new VE with Leo 5.9 from PyPI.
  • See "Log-001"
  1. Try to start Leo with the command-line option "--ipython" enabled.
  • OK - but - no indication is shown in the logs ...
  • See "Log-002"
  • Close this instance of Leo again - and - continue reading the available documentation.
  1. Install IPython 7.5.0 from PyPI.
  • See "Log-003"
  1. Start Leo with the command-line option "--ipython" enabled again.
  • OK - but - still no indication is shown in the logs ...
  • Open the "quickstart.leo" outline - and - close the outlines "WL2018.leo" & "WL2019.leo".
  • Close & restart this instance with the command-line option "--ipython" enabled.
  • See "Log-004"
  • Close this instance of Leo again - and - continue reading ...
  1. Install Jupyter 1.0.0 from PyPI.
  • See "Log-005".
  1. Start Leo with the command-line option "--ipython" enabled again.
  • OK. - Now the Jupyter QtConsole is started in a separate window ...
  • See "Log-006"
  • The "quickstart.leo" outline is unusable - and - gets closed when you quit the Jupyter QtConsole.
  1. Retry this scenario one more time
  • More or less the same behaviour. The "quickstart.leo" outline opens first - but - becomes unusable again once the Jupyter QtConsole (JQC) started.
  • JQC > Kernel > Confirm kernel restart ---> No change on Leo's side ...
  • JQC > Kernel > Restart current Kernel ---> No change on Leo's side ...
  • JQC > Kernel > Interrupt current Kernel ---> No change on Leo's side ...
  • JQC > File > New Tab with New kernel ---> Not OK --> Error starting QtConsole w/ traceback ...
  • JQC > File > Quit ---> Closes JQC - but - "quickstart.leo" outline does not get closed & can only be closed by closing the window ...
  1. Retry this scenario another time w/o triggering the error on the Jupyter side ...
  • The same behaviour, i.e. the "quickstart.leo" outline opens first - but - becomes unusable again once the Jupyter QtConsole (JQC) started.
  • JQC > Kernel > Confirm kernel restart ---> No change on Leo's side ...
  • JQC > Kernel > Restart current Kernel ---> No change on Leo's side ...
Jupyter QtConsole 4.5.1
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
Cannot restart a Kernel I did not start
  • JQC > File > Quit ---> Closes JQC - but - "quickstart.leo" outline does not get closed & can only be closed by closing the window ...
  1. Retry this scenario another time & close the Jupyter side after displaying the copyright ...
  • The same behaviour, i.e. the "quickstart.leo" outline opens first - but - becomes unusable again once the Jupyter QtConsole (JQC) started.
Jupyter QtConsole 4.5.1
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.

copyright
Out[1]:
Copyright (c) 2001-2018 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.
  • JQC > File > Quit ---> Closes JQC - but - "quickstart.leo" outline does not get closed & can only be closed by closing the window ...

Close the terminal "PS C:UsersViktorpyveVE4ILeo>" as well ...


Time to reflect & to start another discussion thread on the leo-editor google-group ;-)


Edward K. Ream

unread,
Jun 23, 2019, 6:49:36 AM6/23/19
to leo-editor
On Sun, Jun 23, 2019 at 4:32 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
Hello Edward & Community,

Since I'm still waiting for feedback on the two other topics I raised here earlier, I spent some time this morning to investigate Leo’s IPython Bridge.

I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(

Is anybody else experiencing the same issue - or - can you tell me what I'm doing wrong / what I should change? - TIA!

Thanks for your researches.  I have no memory of any of this. So I am unlikely to be of any help.

Edward

Viktor Ransmayr

unread,
Jun 23, 2019, 8:23:29 AM6/23/19
to leo-e...@googlegroups.com
Hello Edward,
Thanks for your feedback. - In a while I might reach out to Ville,
since he seems to be the initiator of this sub-project.

With kind regards,

Viktor

john lunzer

unread,
Jun 24, 2019, 8:00:20 AM6/24/19
to leo-editor
I used to use the IPython bridge regularly, back before they renamed IPython to Jupyter. I haven't touched recent versions.

The fact that this doesn't work for you now is potentially the result of code rot; with enough changing in the IPython/Jupyter API to finally(? surprised it didn't happen earlier) break the bridge. I doubt anyone has touched this bridge code in a while. Ville is for the most part long gone. I reached out to him a couple years back and while he responded and was cordial his memory of events wasn't good enough to move my issue forward.

I'm not saying that you need to abandon your efforts but unless somebody else chimes in you may not receive additional guidance. 

Firstly, however, try to determine if it's worth your time.

The IPython bridge doesn't buy you much. It gave me the ability to use IPython's interactive REPL on some of Leo's internals. Most importantly it let me view object structure using auto-completion to dig down into various objects. This was helpful when developing some plugins. You can most likely do similar investigations via Leo scripting, Edward is a wizard at this type of stuff and I'm sure has recipes for any type of Leo introspection you might want to do. 

If Leo is missing anything it's not necessarily IPython/Jupyter integration as is often requested but in general a terminal/console like REPL linked to its internals.

Perhaps you should let us know what you want to do with the bridge before spending a lot of time trying to get it to work. I would say there is only small chance it's going to aid your efforts. 

Viktor Ransmayr

unread,
Jun 24, 2019, 5:27:16 PM6/24/19
to leo-editor
Hello John,


Am Montag, 24. Juni 2019 14:00:20 UTC+2 schrieb john lunzer:

I used to use the IPython bridge regularly, back before they renamed IPython to Jupyter. I haven't touched recent versions.

The fact that this doesn't work for you now is potentially the result of code rot; with enough changing in the IPython/Jupyter API to finally(? surprised it didn't happen earlier) break the bridge. I doubt anyone has touched this bridge code in a while. Ville is for the most part long gone. I reached out to him a couple years back and while he responded and was cordial his memory of events wasn't good enough to move my issue forward.

I'm not saying that you need to abandon your efforts but unless somebody else chimes in you may not receive additional guidance.

Thanks a lot for this clear feedback of yours!

Firstly, however, try to determine if it's worth your time.

The IPython bridge doesn't buy you much. It gave me the ability to use IPython's interactive REPL on some of Leo's internals. Most importantly it let me view object structure using auto-completion to dig down into various objects. This was helpful when developing some plugins. You can most likely do similar investigations via Leo scripting, Edward is a wizard at this type of stuff and I'm sure has recipes for any type of Leo introspection you might want to do. 

If Leo is missing anything it's not necessarily IPython/Jupyter integration as is often requested but in general a terminal/console like REPL linked to its internals.

Perhaps you should let us know what you want to do with the bridge before spending a lot of time trying to get it to work. I would say there is only small chance it's going to aid your efforts.
 
 Yes, I'll try to summarize my expectations & goals wrt. ILeo and an IPython/Jupyter integration here.

Once again thanks a lot for your feedback.

With kind regards,

Viktor

Edward K. Ream

unread,
Jun 25, 2019, 6:30:17 AM6/25/19
to leo-editor
On Sun, Jun 23, 2019 at 4:32 AM Viktor Ransmayr <viktor....@gmail.com> wrote:

> I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(

I'm not sure what you mean by unusable.  When I run leo --ipython I see a message from ipython/jupyter ending in:

To connect another client to this kernel, use:
    --existing kernel-49120.json

Within the JQC, _leo.c and _leo.g are bound as expected:

In [1]:_leo.c
Out[1]: Commander 2323764986824: 'C:/Users/edreamleo/.leo/workbook.leo'

In [2]: _leo.g
Out[2]: <module 'leo.core.leoGlobals' from 'c:\\leo.repo\\leo-editor\\leo\\core\\leoGlobals.py'>


Within the .leo file, executing (Ctrl-B) `print(g.app.ipk)` prints the following in the JQC:

<leo.core.leoIPython.InternalIPKernel object at 0x0000021D0B2C0550>

Executing the same with Leo's ipython-exec command does the same.  In short, Leo's ipython bridge seems to be working for me on Windows 10.

Edward

Viktor Ransmayr

unread,
Jun 25, 2019, 12:13:41 PM6/25/19
to leo-e...@googlegroups.com
Hello Edward,

Am Di., 25. Juni 2019 um 12:30 Uhr schrieb Edward K. Ream <edre...@gmail.com>:
>
> On Sun, Jun 23, 2019 at 4:32 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
>
> > I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(
>
> I'm not sure what you mean by unusable. When I run leo --ipython I see a message from ipython/jupyter ending in:
>
> To connect another client to this kernel, use:
> --existing kernel-49120.json

I don't see a similar message : -( - See JQC output below ...

> Within the JQC, _leo.c and _leo.g are bound as expected:
>
> In [1]:_leo.c
> Out[1]: Commander 2323764986824: 'C:/Users/edreamleo/.leo/workbook.leo'
>
> In [2]: _leo.g
> Out[2]: <module 'leo.core.leoGlobals' from 'c:\\leo.repo\\leo-editor\\leo\\core\\leoGlobals.py'>

This is what I see in JQC:

Jupyter QtConsole 4.5.1
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64
bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.

_leo.c

_leo.g
Out[2]: <module 'leo.core.leoGlobals' from
'c:\\users\\viktor\\pyve\\ve4ileo\\lib\\site-packages\\leo\\core\\leoGlobals.py'>


> Within the .leo file, executing (Ctrl-B) `print(g.app.ipk)` prints the following in the JQC:
>
> <leo.core.leoIPython.InternalIPKernel object at 0x0000021D0B2C0550>

I can't enter any command at Leo's side! - This is what I meant with
unusable ;-)

With kind regards,

Viktor

Viktor Ransmayr

unread,
Jun 25, 2019, 5:09:54 PM6/25/19
to leo-e...@googlegroups.com
Hello Edward & Community,

TL;DR:

Once I sent the previous email, I had one last idea / suspicion, which I hoped might explain the different behaviour b/w your (EKR) and my environment. - I was wrong ...

Longer version:

In order to be able to directly log the output from programs, I usually have a first Leo Logging instance open & perform my tests in a second Leo instance.

Therefore I tried the same steps only with a single Leo instance started.

The behaviour did **not** change. - Below you'll find the logs stored with Wordpad ...

I'm now out of ideas - and - will wait for feedback from the community - as well as - yours.

Obviously only after your return from a hopefully very relaxing vacation!

With kind regards,

Viktor

### Part 1 - Activate VE ...

Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Lernen Sie das neue plattformübergreifende PowerShell kennen – https://aka.ms/pscore6

PS C:\Users\Viktor> cd pyve/VE4ILeo
PS C:\Users\Viktor\pyve\VE4ILeo> ./scripts/activate.ps1
(VE4ILeo) PS C:\Users\Viktor\pyve\VE4ILeo> leo --ipython

### Part 2 - Output from JCP ...

Jupyter QtConsole 4.5.1
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.

_leo.c

_leo.g
Out[2]: <module 'leo.core.leoGlobals' from 'c:\\users\\viktor\\pyve\\ve4ileo\\lib\\site-packages\\leo\\core\\leoGlobals.py'>

### Part 3 - Try to access Leo ...

Still not accessible.

### Part 4 - Quit JQC ...

Closes Leo as well.

Edward K. Ream

unread,
Jul 4, 2019, 11:17:46 AM7/4/19
to leo-editor
On Sun, Jun 23, 2019 at 2:32 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
Hello Edward & Community,

Since I'm still waiting for feedback on the two other topics I raised here earlier, I spent some time this morning to investigate Leo’s IPython Bridge.

I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(

IPython/Jupyter should be installed using Anaconda.  That's the only recommended way, I think.  Hundreds of thousands of scientists use Jupyter this way.  I strongly suggest you do too.

Edward

Viktor Ransmayr

unread,
Jul 6, 2019, 2:51:40 PM7/6/19
to leo-e...@googlegroups.com
Hello Edward,

I don't understand this answer of yours! - See


With kind regards,

Viktor

Edward K. Ream

unread,
Jul 10, 2019, 10:14:00 AM7/10/19
to leo-editor
On Sat, Jul 6, 2019 at 1:51 PM Viktor Ransmayr <viktor....@gmail.com> wrote:


I was able to create an environment, where the Jupyter QtConsole (JQC) is started - however - the associated Leo outline, in my case "quickstart.leo", becomes unusable as soon as the JQC starts :-(

IPython/Jupyter should be installed using Anaconda.  That's the only recommended way, I think.  Hundreds of thousands of scientists use Jupyter this way.  I strongly suggest you do too.

I don't understand this answer of yours!

Does anyone have any other suggestions?

Edward
Reply all
Reply to author
Forward
0 new messages