Re: Steps to install leo using pip in python 3.5

2018-08-16 Thread Terry Brown
On Thu, 16 Aug 2018 21:45:58 -0400
Brian Theado  wrote:

> • Disable python_terminal plugin

Interesting, I'd noticed this too, playing with Docker images as test
install environments.  It seems to be the line

from rlcompleter import Completer

but not that it necessarily fails to import, just that it causes
segfaults.

Cheers -Terry

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Steps to install leo using pip in python 3.5

2018-08-16 Thread Brian Theado
I've found this setup will give a segfault when the python_terminal plugin
is enabled. Using gdb, I see it is almost the same crash already reported
by Chris George a while back:
https://groups.google.com/forum/#!topic/leo-editor/6EVF4Rw8o_I. In his case
he was using Ubuntu 16.04 with python 3.5 and PyQT 5.7. My setup is the
same, except with PyQt 5.10.0.

[...]
0x7fffdc77e3e1 in rl_initialize () from
/usr/lib/x86_64-linux-gnu/libedit.so.2
[...]


Some ways I've found this crash does not happen:

   1. Avoid python 3.5 + PyQT
  1. use conda or some other method to get different version of python
  2. use more recent version of ubuntu which comes with python 3.6+.
  Ubuntu 16.04 is getting old, but it will be a supported release for years
  to come.
   2. Disable python_terminal plugin
   3. Use the --nosplash command line option
   4. Run python with '-m pdb' and then 'c' at the pdb prompt (I was doing
   this to troubleshoot the issue and of course the problem didn't happen)

I have no idea why #3 helps. I think #4 might help because pdb loads
readline which somehow prevents the later readline crash when
python_terminal loads.

I added this to launchLeo.py to get the python trace at the segfault:

import faulthandler; faulthandler.enable()


which gave this:

Leo 5.7.4 devel, build 20180815095610, Wed, Aug 15, 2018  9:56:10 AM
Git repo info: branch = devel, commit = 9db824eb3746
Python 3.5.2, PyQt version 5.10.0
linux
** isPython3: True

Fatal Python error: Segmentation fault

Current thread 0x7fc6d6d53700 (most recent call first):
  File "", line 222 in
_call_with_frames_removed
  File "", line 906 in create_module
  File "", line 577 in module_from_spec
  File "", line 666 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "/usr/lib/python3.5/rlcompleter.py", line 174 in 
  File "", line 222 in
_call_with_frames_removed
  File "", line 665 in exec_module
  File "", line 673 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "[...]/leo-editor/leo/plugins/python_terminal.py", line 52 in

  File "", line 222 in
_call_with_frames_removed
  File "", line 665 in exec_module
  File "", line 673 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "[...]/leo-editor/leo/core/leoPlugins.py", line 516 in
loadOnePluginHelper
  File "[...]/leo-editor/leo/core/leoPlugins.py", line 563 in loadOnePlugin
  File "[...]/leo-editor/leo/core/leoPlugins.py", line 457 in loadHandlers
  File "[...]/leo-editor/leo/core/leoPlugins.py", line 338 in doPlugins
  File "[...]/leo-editor/leo/core/leoGlobals.py", line 5016 in doHook
  File "[...]/leo-editor/leo/core/leoApp.py", line 2219 in load
  File "[...]/leo-editor/leo/core/runLeo.py", line 72 in run
  File "[...]/leo-editor/launchLeo.py", line 9 in 
Segmentation fault (core dumped)


Even if I sidestep the crash using #3 above, I can get a similar readline
related crash by running the unitTests. This time, loading the pdb module
is crashing:

Leo 5.7.4 devel, build 20180807122609, Tue Aug  7 12:26:09 CDT 2018
Git repo info: branch = devel, commit = 532eda4fd138
Python 3.5.2, PyQt version 5.10.0
linux
** isPython3: True

reading settings in /leo/leo/test/unitTest.leo
found  2 doctests for leo.core.leoGlobals
found  1 doctests for leo.core.leoTest
Fatal Python error: Segmentation fault

Current thread 0x7f74a2411700 (most recent call first):
  File "", line 222 in
_call_with_frames_removed
  File "", line 906 in create_module
  File "", line 577 in module_from_spec
  File "", line 666 in _load_unlocked
  File "", line 958 in _find_and_load_unlocked
  File "", line 969 in _find_and_load
  File "/usr/lib/python3.5/pdb.py", line 151 in __init__
  File "/usr/lib/python3.5/doctest.py", line 357 in __init__
  File "/usr/lib/python3.5/doctest.py", line 1453 in run
  File "/usr/lib/python3.5/doctest.py", line 2185 in runTest
  File "/usr/lib/python3.5/unittest/case.py", line 600 in run
  File "/usr/lib/python3.5/unittest/case.py", line 648 in __call__
  File "/usr/lib/python3.5/unittest/suite.py", line 122 in run
  File "/usr/lib/python3.5/unittest/suite.py", line 84 in __call__
  File "/usr/lib/python3.5/unittest/suite.py", line 122 in run
  File "/usr/lib/python3.5/unittest/suite.py", line 84 in __call__
  File "/usr/lib/python3.5/unittest/suite.py", line 122 in run
  File "/usr/lib/python3.5/unittest/suite.py", line 84 in __call__
  File "/usr/lib/python3.5/unittest/runner.py", line 176 in run
  File "/leo/leo/core/leoTest.py", line 659 in doTests
  File "/leo/leo/commands/debugCommands.py", line 185 in
runSelectedUnitTestsLocally
  File "/leo/leo/core/leoGlobals.py", line 320 in new_cmd_wrapper
  File "/leo/leo/core/leoCommands.py", line 2071 in executeAnyCommand
  File "/leo/leo/core/leoCommands.py", line 2042 in doCommand
  File "/leo/leo/core/leoKeys.py", line 3677 in masterCommand
 

Re: Steps to install leo using pip in python 3.5

2018-08-06 Thread Edward K. Ream
On Tue, Jul 17, 2018 at 9:09 PM, Brian Theado 
wrote:

> I created this issue: https://github.com/leo-editor/leo-editor/issues/944,
> but I didn't see a way to tag it.
>

I've added some tags.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Steps to install leo using pip in python 3.5

2018-07-17 Thread Brian Theado
I created this issue: https://github.com/leo-editor/leo-editor/issues/944,
but I didn't see a way to tag it.

On Mon, Jul 16, 2018 at 11:07 PM Matt Wilkie  wrote:

>
> I tried version 5.10.1 of PyQt but got a different error; however, verson
>> 5.10.0 seems to work.
>>
>> $ bin/pip install PyQt5==5.10.0
>>
>> [...]
>
>>
>>
>> It's very nice that leo and its dependencies can now be install via pip
>> on Linux. Clearly there are still some gotchas, but it can work!
>>
>
> Thank you for this clear write up! If you have time please open an issue
> in the Github tracker and tag it 'pip'. Looks like we should be specifying
> version numbers.
>
> Matt
>
> --
> 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 leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Steps to install leo using pip in python 3.5

2018-07-16 Thread Matt Wilkie


> I tried version 5.10.1 of PyQt but got a different error; however, verson 
> 5.10.0 seems to work.
>
> $ bin/pip install PyQt5==5.10.0
>
> [...] 

>  
>
> It's very nice that leo and its dependencies can now be install via pip on 
> Linux. Clearly there are still some gotchas, but it can work!
>

Thank you for this clear write up! If you have time please open an issue in 
the Github tracker and tag it 'pip'. Looks like we should be specifying 
version numbers.

Matt

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Steps to install leo using pip in python 3.5

2018-07-14 Thread Brian Theado
On Ubuntu 16.04 with python 3.5, I tried installing leo into a virtual env
using these commands:

$ python3 -m venv leo-editor-venv
$ cd leo-editor-venv
$ bin/pip install leo


When I run leo, I get this error

$ bin/leo
leoQt.py: can not fully import PyQt5.
Traceback (most recent call last):
  File "bin/leo", line 7, in 
from leo.core.runLeo import run
  File
"[...]/leo-editor-venv/lib/python3.5/site-packages/leo/core/runLeo.py",
line 27, in 
leoGlobals.app = leoApp.LeoApp()
  File
"[...]/leo-editor-venv/lib/python3.5/site-packages/leo/core/leoApp.py",
line 324, in __init__
import leo.core.leoFrame as leoFrame
  File
"[...]/leo-editor-venv/lib/python3.5/site-packages/leo/core/leoFrame.py",
line 13, in 
import leo.core.leoColorizer as leoColorizer
  File
"[...]/leo-editor-venv/lib/python3.5/site-packages/leo/core/leoColorizer.py",
line 9, in 
from leo.core.leoQt import Qsci, QtGui, QtWidgets # isQt5, QtCore
  File
"[...]/leo-editor-venv/lib/python3.5/site-packages/leo/core/leoQt.py", line
76, in 
qt_version = QtCore.QT_VERSION_STR
NameError: name 'QtCore' is not defined


After some investigaton, I see that leo's exception handling is hiding the
real error message. I used pdb to find it:

$ bin/python -m pdb  bin/leo
(Pdb) break leo/core/leoQt.py:20


Then stepping line-by-line leads to this at line 53:

 53  -> from PyQt5 import QtCore
ImportError:
[...]/leo-editor-venv/lib/python3.5/site-packages/PyQt5/QtCore.so:
undefined symbol: PySlice_AdjustIndices


Searching for that error message leads to these links, which point the
finger at the latest PyQt wheel not being compatible with python 3.5:

https://github.com/mu-editor/mu/issues/502#issuecomment-399682079
https://github.com/mu-editor/mu/issues/538#issuecomment-404096351
"Chipping in rather late: the error message in the OP refers to a Python
API that was only added in 3.6.1. Since the venv is using Python 3.5 it
appears that Qt have offered a wheel for 3.5 which uses code only available
in 3.6"


Here's the version of PyQt which pip installed in my virtual environment:

$ bin/pip freeze | grep PyQt5==
PyQt5==5.11.2


I tried version 5.10.1 of PyQt but got a different error; however, verson
5.10.0 seems to work.

$ bin/pip install PyQt5==5.10.0


In summary, these steps can lead to a working leo virtual env install from
pip on python 3.5:

$ python3 -m venv leo-editor-venv
$ cd leo-editor-venv
$ bin/pip install leo
$ bin/pip install PyQt5==5.10.0
$ bin/leo


It's very nice that leo and its dependencies can now be install via pip on
Linux. Clearly there are still some gotchas, but it can work!

Brian

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.