iLeo not working

139 views
Skip to first unread message

tfer

unread,
Apr 3, 2020, 5:23:43 AM4/3/20
to leo-editor
Trying to start the iPython Bridge:

(leobase) C:\VC\git\leo-editor [devel ≡ +3 ~1 -0 !]> python .\launchLeo.py --ipython

I got this in the console:

leoIpython.py: can not import connect_qtconsole
leoIpython.py: can not import IPKernelApp
Leo 6.3-devel, devel branch, build 269d953c87

tfer

unread,
Apr 3, 2020, 5:49:48 AM4/3/20
to leo-editor
should have check here first, google lead me back to:


I'll try suggestions there.

tfer

unread,
Apr 3, 2020, 6:44:16 AM4/3/20
to leo-editor
Create a new env, leobase2, ran:
 pip install --editable .
with setuo,py modified so the nbformat requirement was commented out, (to do nothing with juypter/iPython).  Then I ran:
pip install notebook
to get all the Juypter/iPython stuff.  Ran:
python .\launchLeo.py --ipython
Got this:
Leo 6.3-devel, devel branch, build 269d953c87
2020-04-03 10:51:14 +0200
kernelApp.initialize failed!
Traceback (most recent call last):

  File "C:\VC\git\leo-editor\leo\plugins\qt_gui.py", line 1345, in runWithIpythonKernel
    g.app.ipk = leoIPython.InternalIPKernel()

  File "C:\VC\git\leo-editor\leo\core\leoIPython.py", line 98, in __init__
    kernelApp = self.pylab_kernel(backend)

  File "C:\VC\git\leo-editor\leo\core\leoIPython.py", line 220, in pylab_kernel
    kernelApp.initialize(args)

  File "<decorator-gen-125>", line 2, in initialize

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\ipykernel\kernelapp.py", line 550, in initialize
    self.write_connection_file()

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\ipykernel\kernelapp.py", line 225, in write_connection_file
    write_connection_file(cf, ip=self.ip, key=self.session.key, transport=self.transport,

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\jupyter_client\connect.py", line 138, in write_connection_file
    with secure_write(fname) as f:

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\jupyter_core\paths.py", line 435, in secure_write
    win32_restrict_file_to_user(fname)

  File "C:\ProgramData\Miniconda3\envs\leobase2\lib\site-packages\jupyter_core\paths.py", line 361, in win32_restrict_file_to_user
    import win32api

ImportError: DLL load failed while importing win32api: The specified module could not be found.

can not init leo.core.leoIPython.py 
 
 

tfer

unread,
Apr 3, 2020, 7:23:00 AM4/3/20
to leo-editor
Progress, but not there yet.  DLL problem seems to be a Python 3.8 problem, related to a security restriction in the search path for dll's.  Temp fix was to copy them into c:/Windows/System32.  Now Leo starts but:

(leobase2) C:\VC\git\leo-editor [devel ≡ +3 ~2 -0 !]> python .\launchLeo.py --ipython

Leo 6.3-devel, devel branch, build 269d953c87
2020-04-03 10:51:14 +0200
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.



To connect another client to this kernel, use:
    --existing kernel-18488.json
[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?
new_qt_console <subprocess.Popen object at 0x0000025F13BBADF0>
No iPython qt-console opens

tfer

unread,
Apr 3, 2020, 7:34:49 AM4/3/20
to leo-editor

pip installed matplotlib, no change

Edward K. Ream

unread,
Apr 3, 2020, 9:18:38 AM4/3/20
to leo-editor
On Fri, Apr 3, 2020 at 4:23 AM 'tfer' via leo-editor <leo-e...@googlegroups.com> wrote:

Trying to start the iPython Bridge:

I don't see the ipython console either. Python 3.7.6. matplotlib installed.

I've just created #1561 for this.

Edward

Thomas Passin

unread,
Apr 3, 2020, 10:33:31 AM4/3/20
to leo-e...@googlegroups.com
It's not going to work with Python 3.8 either.  There's been some change to the asnyc API that Tornado hasn't adjusted to.  I believe there is a workaround, but I don't have the reference handy.


py38 -m leo.core.runLeo --ipython

...
  File "C:\Users\tom\AppData\Local\Programs\Python\Python38\lib\site-packages\tornado\platform\asyncio.py", line 99, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)

  File "C:\Users\tom\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError

tfer

unread,
Apr 3, 2020, 1:35:53 PM4/3/20
to leo-editor
created a fresh 3.7 virtual env, changed requrement in setup.py from nbformat to notebook, ran pip install -e ., then launched:

(lb-3.7) C:\VC\git\leo-editor [devel ≡ +3 ~2 -0 !]> python .\launchLeo.py --ipython          
                                                                                             
Leo 6.3-devel, devel branch, build 269d953c87                                                
2020-04-03 10:51:14 +0200                                                                    
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.                     
                                                                                             
To exit, you will have to explicitly quit this process, by either sending                    
"quit" from a client, or using Ctrl-\ in UNIX-like environments.                             
                                                                                             
To read more about this, see https://github.com/ipython/ipython/issues/2049                  
                                                                                             
                                                                                             
To connect another client to this kernel, use:                                               
    --existing kernel-3352.json                                                              
[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed? 
new_qt_console <subprocess.Popen object at 0x00000228A399AE08>                               

Leo hung with a mostly blank window 

tfer

unread,
Apr 5, 2020, 10:20:17 PM4/5/20
to leo-editor
Running:
python -m trace --trace  .\launchLeo.py --ipython
A long trace, the app loaded the last session, then closed with this being the tail of the output:

<frozen importlib._bootstrap>(104): <frozen importlib._bootstrap>(105): <frozen importlib._bootstrap>(106): <frozen importlib._bootstrap>(108): <frozen importlib._bootstrap>(109): <frozen importlib._bootstrap>(110): <frozen importlib._bootstrap>(111): <frozen importlib._bootstrap>(112):  --- modulename: _bootstrap, funcname: cb
Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\lb-3.7\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\ProgramData\Miniconda3\envs\lb-3.7\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Miniconda3\envs\lb-3.7\lib\trace.py", line 736, in <module>
    main()
  File "C:\ProgramData\Miniconda3\envs\lb-3.7\lib\trace.py", line 724, in main
    t.runctx(code, globs, globs)
  File "C:\ProgramData\Miniconda3\envs\lb-3.7\lib\trace.py", line 450, in runctx
    exec(cmd, globals, locals)
  File ".\launchLeo.py", line 8, in <module>
    leo.core.runLeo.run()
  File ".\leo\core\runLeo.py", line 68, in run
  File ".\leo\core\leoApp.py", line 2647, in load
  File ".\leo\plugins\qt_gui.py", line 1326, in runMainLoop
  File ".\leo\plugins\qt_gui.py", line 1424, in show_tips
ModuleNotFoundError: No module named 'leo.core.leoTips'
<frozen importlib._bootstrap>(177): <frozen importlib._bootstrap>(178): <frozen importlib._bootstrap>(182): <frozen importlib._bootstrap>(183): <frozen importlib._bootstrap>(185):

Not sure if this is telling me anything.

Edward K. Ream

unread,
Apr 6, 2020, 7:51:31 AM4/6/20
to leo-editor
On Sun, Apr 5, 2020 at 9:20 PM 'tfer' via leo-editor <leo-e...@googlegroups.com> wrote:
Running:
python -m trace --trace  .\launchLeo.py --ipython
A long trace, the app loaded the last session, then closed with this being the tail of the output:
[snip]
ModuleNotFoundError: No module named 'leo.core.leoTips'
<frozen importlib._bootstrap>(177): <frozen importlib._bootstrap>(178): <frozen importlib._bootstrap>(182): <frozen importlib._bootstrap>(183): <frozen importlib._bootstrap>(185):

Not sure if this is telling me anything.

It looks like the culprit to me. Matt, do you have any insights?

Edward

tfer

unread,
Apr 6, 2020, 12:10:27 PM4/6/20
to leo-editor
Not sure if the above trace is capturing the problem, running with trace enable changes how thing go, without tracing Leo hangs with its main widow open but no panes populating it, with the above, it did draw the pane then closed.

Tried another run with:

(lb-3.7) C:\VC\git\leo-editor [devel ≡ +3 ~3 -0 !]> python -m trace --trace launchLeo.py --ipython

and then froze with (not responding) in the title bar. Trace froze also, tail is:

 --- modulename: py3compat, funcname: encode
py3compat.py(20):     encoding = encoding or DEFAULT_ENCODING
py3compat.py(21):     return u.encode(encoding, "replace")
iostream.py(296):         self.parent_header = {}
iostream.py(297):         self._master_pid = os.getpid()
iostream.py(298):         self._flush_pending = False
iostream.py(299):         self._io_loop = pub_thread.io_loop
iostream.py(300):         self._new_buffer()
 --- modulename: iostream, funcname: _new_buffer
iostream.py(436):         self._buffer = StringIO()
iostream.py(301):         self.echo = None
iostream.py(303):         if echo:

Matt Wilkie

unread,
Apr 6, 2020, 6:10:00 PM4/6/20
to leo-editor
I haven't tried anything ipython for a very long time so not sure I can help much. These two lines in the traceback stand out to me though:

  File ".\leo\plugins\qt_gui.py", line 1424, in show_tips
ModuleNotFoundError: No module named 'leo.core.leoTips'


...later: Win10 x64, python 3.6.9 in a conda env.

python .\launchLeo.py --ipython

leoIpython
.py: can not import connect_qtconsole
leoIpython
.py: can not import IPKernelApp
Leo 6.3-devel, devel branch, build 8051ecd172
2020-04-05 05:55:36 -0500

Leo worked fine, but no ipython, which isn't surprising because I haven't installed it.

pip install notebook
python
.\launchLeo.py --ipython

Now Leo locks up like you described earlier. However there's a message in the console:

[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?

new_qt_console
<subprocess.Popen object at 0x0000015DEFE77DA0>

So I pip installed matplotlib and tried again. Leo now does not lock up and appears to functioning normally. The console still complains that matplotlib integration fails though.

Here's the last console log:

# python .\launchLeo.py --ipython

Leo 6.3-devel, devel branch, build 8051ecd172
2020-04-05 05:55:36 -0500
don
't forget to launch leo-ver-serv!!!

NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


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

[IPKernelApp] WARNING | Eventloop or matplotlib integration failed. Is matplotlib installed?
new_qt_console <subprocess.Popen object at 0x000002657FF2B2E8>
wrote recent file: D:/Matt/Dropbox/.leo/.leoRecentFiles.txt
error writing D:/Matt/Dropbox/.leo/.leoRecentFiles.txt

Traceback (most recent call last):

 File "D:\Matt\code\leo-editor\leo\core\leoApp.py", line 4009, in writeRecentFilesFileHelper
 with io.open(fileName, encoding='
utf-8', mode='w') as f:

OSError: [Errno 22] Invalid argument: '
D:/Matt/Dropbox/.leo/.leoRecentFiles.txt'

QSocketNotifier: Multiple socket notifiers for same socket 2224 and type Read
QSocketNotifier: Multiple socket notifiers for same socket 2288 and type Read

After exiting Leo I needed to Ctrl-C in the console window to get control back.

Summary: `pip install notebook matplotlib` is enough to get Leo iself working with python 3.6 (windows) but I'm not sure if the ipython connection is working/usable.

-matt

tfer

unread,
Apr 7, 2020, 12:01:40 AM4/7/20
to leo-editor
Much as I find things.  The console indicates that a kernel has been been started, but the qt compatible event loop did not start, no qt-console with IPython appears, Leo remains in a hang state.

The problem is probably in the IPython code, they're changing everything to use Juypter Notebooks, warning that all the options are being depreciated, I think they already messed them up.

I was messing with this because I had come across code that let you hook a IPython's kernel into a Juypter notebook, but things are in such flux, perhaps it's best to wait for the next release of Jupyter, and make a JuypterBridge.

lewis

unread,
May 20, 2020, 4:40:04 AM5/20/20
to leo-editor
launchleo.py --ipython
is working again with ipython version 7.14.0, and QtConsole version 4.7.4

Leo Log Window
Leo 6.3-devel, devel branch, build e7f2e02cc6
2020-05-18 06:55:35 -0500
Python 3.8.2, PyQt version 5.14.2
Windows 10 AMD64 (build 10.0.18362) SP0

Regards
Lewis

tfer

unread,
May 20, 2020, 11:56:08 AM5/20/20
to leo-editor
Thanks Lewis, I'll give it a try
Reply all
Reply to author
Forward
0 new messages