New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make `python setup.py install` work again - from #810 #968

Open
brobr opened this Issue Aug 27, 2018 · 20 comments

Comments

Projects
None yet
4 participants
@brobr

brobr commented Aug 27, 2018

spawned from #810. Summary:

For creating a distribution package one could -in versions prior to 5.7- copy the files 'leo/dist/leo-install.py' and 'leo/dist/setup.py' to the main directory and from there run
python setup.py install --root=$PKG with as target the folder in which the package is created ($PKG).

...

Hi, thanks for the update and an extended leo-5.7, which I managed to compile with the leo-5.6/leo/dist/setup.py outwith pip but whether the program is now fully functional time will tell:

There have a been changes in setup.py since 5.6 not specifically related to pip.

If there are specific reasons you can't, re-open this issue and we can explore what might be done. I'll need information and feedback though as I don't know about building distribution packages.

The request for a setup.py that works via install is that it can compile the program in such a way that it can be packaged (that is 'installed') outwith the python-installation of the computer that does the compilation. With 'python setup.py install' one can direct installation of the compiled program to a folder in /tmp, say '/tmp/ leo-package', which will contain a folder structure mimicking the one of any computer that runs that distribution. Then this leo-package folder -after compressing- can be distributed among users/computers that run this distribution. The install/upgrade-scripts of that distribution will then copy the bits from the package into the python-distribution of that computer. Of course, in order to run the installed program correctly, all necessary dependencies have to be installed.

Thus, users of that distribution can just use the distributed binary or compile the program on their box as if they are an admin using the distribution-specific compile scripts as longs as their box is in a similar state as that of the admin/distributor.

As an administrator of many computers which need to get a python program installed, one would prefer to only use the distribution-specific install/upgrade tools as this provides an easy way to check what has been installed and/or what needs updating on each computer. In such a scenario, when on top of this, as not all is python on those boxes- one needs to check pip for python updates on each and every computer, things can become difficult to manage. Especially if this also would hold for modules for other programming environments that come with their own installers (e.g. ruby) if these could not be compiled into a form that can be distributed.

The pip-install is excellent for users with one computer to manage, but if this number increases it becomes quite hard to maintain a set of computers if one is forced to, as currently for leo-5.7, to use pip outwith the common distribution-specific routine.

In the end, you run the risk of losing users who rely on distributed versions of leo:

There have a been changes in setup.py since 5.6 not specifically related to pip. Sooner or later using the old version will probably stop working. Pip solves a lot of problems, are you sure you can't use it?
as this will in the end break the usage of the leo-5.6/leo/dist/setup.py

Note, that pip and wheels do not solve any problem for admins who have their computers up to date - or in a consistent state of versions of packages that can work together and want to keep it that way.

Hope this clarifies the request,

rob

@maphew maphew self-assigned this Aug 27, 2018

@maphew maphew added the Pip label Aug 27, 2018

@maphew maphew changed the title from python setup.py install does not complete (#810) -reopened to make `python setup.py install` work again - from #810 Aug 27, 2018

@maphew maphew added the Bug label Aug 27, 2018

@maphew maphew added this to the 5.8 milestone Aug 27, 2018

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Aug 27, 2018

Member

commit e3a1ba9 opens a new branch for this project,
https://github.com/leo-editor/leo-editor/tree/setup-968

Files of note:

./build-without-pip.sh
    #copy v5.6 setup to root and run python setup
./leo/dist/setup*5.6*

On my linux laptop - Linux Mint 18.2 - python setup.py install --root=$PKG completes successfully but the resultant leo errors out with a version conflict. What happens for you?

/tmp/packages/home/matt/miniconda3/bin/leoc --version
Traceback (most recent call last):
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 574, in _build_master
    ws.require(__requires__)
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (leo 5.7.3 (/home/matt/miniconda3/lib/python3.6/site-packages), Requirement.parse('leo===5.8.devel'))
[...snip...]
Member

maphew commented Aug 27, 2018

commit e3a1ba9 opens a new branch for this project,
https://github.com/leo-editor/leo-editor/tree/setup-968

Files of note:

./build-without-pip.sh
    #copy v5.6 setup to root and run python setup
./leo/dist/setup*5.6*

On my linux laptop - Linux Mint 18.2 - python setup.py install --root=$PKG completes successfully but the resultant leo errors out with a version conflict. What happens for you?

/tmp/packages/home/matt/miniconda3/bin/leoc --version
Traceback (most recent call last):
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 574, in _build_master
    ws.require(__requires__)
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 892, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/matt/miniconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 783, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (leo 5.7.3 (/home/matt/miniconda3/lib/python3.6/site-packages), Requirement.parse('leo===5.8.devel'))
[...snip...]
@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Aug 28, 2018

Member

I setup Travis Continual Integration to try running python setup.py install in it's VM, which is guaranteed fresh and clean unlike my laptop. ;-) Setup is successful but Leo doesn't work there either, though exits with a different error.

$ /tmp/packages/home/travis/virtualenv/python2.7.14/bin/leoc --version
Traceback (most recent call last):
  File "/tmp/packages/home/travis/virtualenv/python2.7.14/bin/leoc", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3144, in <module>
    @_call_aside
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3128, in _call_aside
    f(*args, **kwargs)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3157, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in _build_master
    ws.require(__requires__)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 870, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'leo===5.8.devel' distribution was not found and is required by the application

Full log at https://travis-ci.org/leo-editor/leo-editor/branches

Member

maphew commented Aug 28, 2018

I setup Travis Continual Integration to try running python setup.py install in it's VM, which is guaranteed fresh and clean unlike my laptop. ;-) Setup is successful but Leo doesn't work there either, though exits with a different error.

$ /tmp/packages/home/travis/virtualenv/python2.7.14/bin/leoc --version
Traceback (most recent call last):
  File "/tmp/packages/home/travis/virtualenv/python2.7.14/bin/leoc", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3144, in <module>
    @_call_aside
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3128, in _call_aside
    f(*args, **kwargs)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3157, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in _build_master
    ws.require(__requires__)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 984, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/pkg_resources/__init__.py", line 870, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'leo===5.8.devel' distribution was not found and is required by the application

Full log at https://travis-ci.org/leo-editor/leo-editor/branches

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Aug 28, 2018

Member

With 8a7803a I have python setup.py install working now with the mainline setup.py. It was a silly one line change that belies the hours of head scratching and cursing to identify it!

We still have the pkg_resources.DistributionNotFound error in Travis when running Leo, but I'm hoping that is something peculiar to travis and virtual environments and that this will work for you. Please test and let me know.

Member

maphew commented Aug 28, 2018

With 8a7803a I have python setup.py install working now with the mainline setup.py. It was a silly one line change that belies the hours of head scratching and cursing to identify it!

We still have the pkg_resources.DistributionNotFound error in Travis when running Leo, but I'm hoping that is something peculiar to travis and virtual environments and that this will work for you. Please test and let me know.

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Aug 28, 2018

Member

I don't know why, but if I pip install --editable <leo-git-checkout-dir> before running python setup.py install then the distribution error goes away:
https://travis-ci.org/leo-editor/leo-editor/builds/421434824

Member

maphew commented Aug 28, 2018

I don't know why, but if I pip install --editable <leo-git-checkout-dir> before running python setup.py install then the distribution error goes away:
https://travis-ci.org/leo-editor/leo-editor/builds/421434824

@brobr

This comment has been minimized.

Show comment
Hide comment
@brobr

brobr Aug 28, 2018

Hi, Thanks a lot for looking into this.
At my end, compilation works excellent via python setup.py install when using the branch https://github.com/leo-editor/leo-editor/tree/setup-968. The major changes on standard out were these:

....
--- Getting long description ---
('\n', ImportError('No module named pypandoc',))
*** Warning: could not convert Readme.md to .rst (harmless for users)
Removing build, dist and egg directories
('\n', ImportError('No module named semantic_version',))
*** Failed to parse Semantic Version from git tag '5.8 devel'.
Expecting tag name like '5.7b2', 'leo-4.9.12', 'v4.3' for releases.
This version can't be uploaded to PyPi.org.
no previously-included directories found matching 'docs'
no previously-included directories found matching 'tests'
warning: no previously-included files matching '.py[cod]' found anywhere in distribution
warning: no previously-included files matching 'pycache' found anywhere in distribution
warning: no previously-included files found matching 'Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching '.flake8'
zip_safe flag not set; analyzing archive contents...
Installed /tmp/SBo/leo-editor-setup-968/.eggs/semantic_version-2.6.0-py2.7.egg
/usr/lib64/python2.7/site-packages/setuptools/dist.py:407: UserWarning: The version specified ('5.8 devel') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
running install
....
copying leo/external/concurrent/futures/init.py -> build/lib/leo/external/concurrent/futures
running egg_info
creating leo.egg-info
writing requirements to leo.egg-info/requires.txt
writing leo.egg-info/PKG-INFO
writing top-level names to leo.egg-info/top_level.txt
writing dependency_links to leo.egg-info/dependency_links.txt
writing entry points to leo.egg-info/entry_points.txt
writing manifest file 'leo.egg-info/SOURCES.txt'
reading manifest file 'leo.egg-info/SOURCES.txt'
writing manifest file 'leo.egg-info/SOURCES.txt'
creating build/lib/leo/dist
copying leo/dist/leo-install.py -> build/lib/leo/dist
running build_scripts
creating build/scripts-2.7
copying and adjusting leo/dist/leo-install.py -> build/scripts-2.7
changing mode of build/scripts-2.7/leo-install.py from 644 to 755
running install_lib
creating /tmp/SBo/package-leo/usr
creating /tmp/SBo/package-leo/usr/lib64
creating /tmp/SBo/package-leo/usr/lib64/python2.7
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist
copying build/lib/leo/dist/leo-install.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/init.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/abbrevCommands.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/baseCommands.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
....
copying build/lib/leo/plugins/zenity_file_dialogs.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/plugins
copying build/lib/leo/init.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist/leo-install.py to leo-install.pyc
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands/init.py to init.pyc
.....
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/init.py to init.pyc
running install_egg_info
Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.8.devel-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leo-m script to /tmp/SBo/package-leo/usr/bin
Installing leo-console script to /tmp/SBo/package-leo/usr/bin
Installing leo-c script to /tmp/SBo/package-leo/usr/bin
Installing leo-messages script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin
Slackware package maker, version 3.14159265.
.......

Only leo does not work; it asks now for more modules: 'keyring', 'wheel', 'twine', without which leo ran happily before:

pkg_resources.DistributionNotFound: The 'keyring' distribution was not found and is required by leo

...after install keyring and its dependencies:

pkg_resources.DistributionNotFound: The 'wheel' distribution was not found and is required by leo

..after install wheel:

pkg_resources.DistributionNotFound: The 'twine' distribution was not found and is required by leo

As twine seems to be needed for interractinon with pypi I stopped here...
hth

brobr commented Aug 28, 2018

Hi, Thanks a lot for looking into this.
At my end, compilation works excellent via python setup.py install when using the branch https://github.com/leo-editor/leo-editor/tree/setup-968. The major changes on standard out were these:

....
--- Getting long description ---
('\n', ImportError('No module named pypandoc',))
*** Warning: could not convert Readme.md to .rst (harmless for users)
Removing build, dist and egg directories
('\n', ImportError('No module named semantic_version',))
*** Failed to parse Semantic Version from git tag '5.8 devel'.
Expecting tag name like '5.7b2', 'leo-4.9.12', 'v4.3' for releases.
This version can't be uploaded to PyPi.org.
no previously-included directories found matching 'docs'
no previously-included directories found matching 'tests'
warning: no previously-included files matching '.py[cod]' found anywhere in distribution
warning: no previously-included files matching 'pycache' found anywhere in distribution
warning: no previously-included files found matching 'Makefile'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files found matching '.flake8'
zip_safe flag not set; analyzing archive contents...
Installed /tmp/SBo/leo-editor-setup-968/.eggs/semantic_version-2.6.0-py2.7.egg
/usr/lib64/python2.7/site-packages/setuptools/dist.py:407: UserWarning: The version specified ('5.8 devel') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
running install
....
copying leo/external/concurrent/futures/init.py -> build/lib/leo/external/concurrent/futures
running egg_info
creating leo.egg-info
writing requirements to leo.egg-info/requires.txt
writing leo.egg-info/PKG-INFO
writing top-level names to leo.egg-info/top_level.txt
writing dependency_links to leo.egg-info/dependency_links.txt
writing entry points to leo.egg-info/entry_points.txt
writing manifest file 'leo.egg-info/SOURCES.txt'
reading manifest file 'leo.egg-info/SOURCES.txt'
writing manifest file 'leo.egg-info/SOURCES.txt'
creating build/lib/leo/dist
copying leo/dist/leo-install.py -> build/lib/leo/dist
running build_scripts
creating build/scripts-2.7
copying and adjusting leo/dist/leo-install.py -> build/scripts-2.7
changing mode of build/scripts-2.7/leo-install.py from 644 to 755
running install_lib
creating /tmp/SBo/package-leo/usr
creating /tmp/SBo/package-leo/usr/lib64
creating /tmp/SBo/package-leo/usr/lib64/python2.7
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist
copying build/lib/leo/dist/leo-install.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist
creating /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/init.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/abbrevCommands.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
copying build/lib/leo/commands/baseCommands.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands
....
copying build/lib/leo/plugins/zenity_file_dialogs.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/plugins
copying build/lib/leo/init.py -> /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/dist/leo-install.py to leo-install.pyc
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/commands/init.py to init.pyc
.....
byte-compiling /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo/init.py to init.pyc
running install_egg_info
Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.8.devel-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leo-m script to /tmp/SBo/package-leo/usr/bin
Installing leo-console script to /tmp/SBo/package-leo/usr/bin
Installing leo-c script to /tmp/SBo/package-leo/usr/bin
Installing leo-messages script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin
Slackware package maker, version 3.14159265.
.......

Only leo does not work; it asks now for more modules: 'keyring', 'wheel', 'twine', without which leo ran happily before:

pkg_resources.DistributionNotFound: The 'keyring' distribution was not found and is required by leo

...after install keyring and its dependencies:

pkg_resources.DistributionNotFound: The 'wheel' distribution was not found and is required by leo

..after install wheel:

pkg_resources.DistributionNotFound: The 'twine' distribution was not found and is required by leo

As twine seems to be needed for interractinon with pypi I stopped here...
hth

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 11, 2018

Member

Yeah, properly speaking 'keyring, wheel, twine' are developer only dependencies and not required for running Leo. I did have them separated out last year but ran into problems with user and developer modes not working like the docs I was reading said I could expect. I'll take another run at it.

In the interim you could run pip uninstall keyring wheel twine in your build environment after running python setup.py {...} and before deploying to users?

Member

maphew commented Sep 11, 2018

Yeah, properly speaking 'keyring, wheel, twine' are developer only dependencies and not required for running Leo. I did have them separated out last year but ran into problems with user and developer modes not working like the docs I was reading said I could expect. I'll take another run at it.

In the interim you could run pip uninstall keyring wheel twine in your build environment after running python setup.py {...} and before deploying to users?

@brobr

This comment has been minimized.

Show comment
Hide comment
@brobr

brobr Sep 12, 2018

Hi maphew, at my end I can get rid of those errors by commenting out the line:
'twine','wheel','keyring' # Pip packaging, uploading to PyPi
in the
user_requires = [ ]
of setup.py

Then running leo stumbled over the absence of pypandoc and wheels (asked for by pypandoc). I found installing pandoc with all its haskell-depencencies a bit too much for testing; I just installed pypandoc (thus without pandoc) and wheels, and then ran into below AssertionError.

bash-4.4$ leo
setting leoID from os.getenv('USER'): 'rob'
Leo 5.8 devel
Not running from a git repo
Python 2.7.15, PyQt version 5.7.1
linux2
** isPython3: False
reading settings in /home/rob/.leo/workbook.leo
Traceback (most recent call last):
File "/usr/bin/leo", line 11, in
load_entry_point('leo===5.8-devel', 'gui_scripts', 'leo')()
File "/usr/lib64/python2.7/site-packages/leo/core/runLeo.py", line 72, in run
g.app.loadManager.load(fileName, pymacs)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2246, in load
ok = lm.doPostPluginsInit()
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2300, in doPostPluginsInit
c1 = lm.openEmptyWorkBook()
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2343, in openEmptyWorkBook
c = lm.loadLocalFile(fn, gui=g.app.gui, old_c=None)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 3062, in loadLocalFile
c = lm.openFileByName(fn, gui, old_c, previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 3084, in openFileByName
previousSettings=previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 1558, in newCommander
return leoCommands.Commands(fileName, relativeFileName, gui, previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoCommands.py", line 77, in init
c.finishCreate()
File "/usr/lib64/python2.7/site-packages/leo/core/leoCommands.py", line 397, in finishCreate
c.frame.finishCreate()
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 1994, in finishCreate
f.top = g.app.gui.frameFactory.createFrame(f)
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 4495, in createFrame
dw.construct(master=tabw)
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 110, in construct
assert g.os_path_exists(ui_description_file)
AssertionError

This also happended on a build for which I had pypandoc commented out as a requirement in setup.py. Leo-5.7.3, as stated above, built ok (using the procedure of 'build-without-pip') and does not run into such an error (or is this because my .leo files are no longer ok to use?).

brobr commented Sep 12, 2018

Hi maphew, at my end I can get rid of those errors by commenting out the line:
'twine','wheel','keyring' # Pip packaging, uploading to PyPi
in the
user_requires = [ ]
of setup.py

Then running leo stumbled over the absence of pypandoc and wheels (asked for by pypandoc). I found installing pandoc with all its haskell-depencencies a bit too much for testing; I just installed pypandoc (thus without pandoc) and wheels, and then ran into below AssertionError.

bash-4.4$ leo
setting leoID from os.getenv('USER'): 'rob'
Leo 5.8 devel
Not running from a git repo
Python 2.7.15, PyQt version 5.7.1
linux2
** isPython3: False
reading settings in /home/rob/.leo/workbook.leo
Traceback (most recent call last):
File "/usr/bin/leo", line 11, in
load_entry_point('leo===5.8-devel', 'gui_scripts', 'leo')()
File "/usr/lib64/python2.7/site-packages/leo/core/runLeo.py", line 72, in run
g.app.loadManager.load(fileName, pymacs)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2246, in load
ok = lm.doPostPluginsInit()
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2300, in doPostPluginsInit
c1 = lm.openEmptyWorkBook()
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 2343, in openEmptyWorkBook
c = lm.loadLocalFile(fn, gui=g.app.gui, old_c=None)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 3062, in loadLocalFile
c = lm.openFileByName(fn, gui, old_c, previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 3084, in openFileByName
previousSettings=previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoApp.py", line 1558, in newCommander
return leoCommands.Commands(fileName, relativeFileName, gui, previousSettings)
File "/usr/lib64/python2.7/site-packages/leo/core/leoCommands.py", line 77, in init
c.finishCreate()
File "/usr/lib64/python2.7/site-packages/leo/core/leoCommands.py", line 397, in finishCreate
c.frame.finishCreate()
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 1994, in finishCreate
f.top = g.app.gui.frameFactory.createFrame(f)
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 4495, in createFrame
dw.construct(master=tabw)
File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 110, in construct
assert g.os_path_exists(ui_description_file)
AssertionError

This also happended on a build for which I had pypandoc commented out as a requirement in setup.py. Leo-5.7.3, as stated above, built ok (using the procedure of 'build-without-pip') and does not run into such an error (or is this because my .leo files are no longer ok to use?).

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 13, 2018

Member

Set HOME to an empty folder before running Leo to ensure a clean start (bypasses old workbook.leo, leoSettings.leo, cached files, etc.). For linux something like this I think:

HOME=/tmp/leo-test-123 leo
  # or:
env HOME=/tmp/leo-test-123 leo

Absence of pandoc shouldn't cause Leo to fail to run.

The assertion error looks like something I've seen before where not all icons etc. are in the expected place(s). ...ahhh, there it is https://groups.google.com/d/msg/leo-editor/L6xmtPj5jeY/lJkOFlOYa9UJ -- 7 years ago! More current is #603, but still not quite on point.

Meta: When you can, attach long console logs as a text files and snip to the beginning and end of the traceback inline. It makes it easier to scan back and forth through the thread. Thanks!

Member

maphew commented Sep 13, 2018

Set HOME to an empty folder before running Leo to ensure a clean start (bypasses old workbook.leo, leoSettings.leo, cached files, etc.). For linux something like this I think:

HOME=/tmp/leo-test-123 leo
  # or:
env HOME=/tmp/leo-test-123 leo

Absence of pandoc shouldn't cause Leo to fail to run.

The assertion error looks like something I've seen before where not all icons etc. are in the expected place(s). ...ahhh, there it is https://groups.google.com/d/msg/leo-editor/L6xmtPj5jeY/lJkOFlOYa9UJ -- 7 years ago! More current is #603, but still not quite on point.

Meta: When you can, attach long console logs as a text files and snip to the beginning and end of the traceback inline. It makes it easier to scan back and forth through the thread. Thanks!

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 16, 2018

Member

I haven't made any appreciable progress, though I have managed to replicate the Travis pkg_resources.DistributionNotFound: The 'leo===5.8.devel' distribution was not found error on my laptop so at least testing is faster. This Stack Overflow post indicates it might be a path not found problem: https://stackoverflow.com/questions/35457144/pkg-resources-distributionnotfound-when-using-a-module-installed-from-a-bdist-rp

Member

maphew commented Sep 16, 2018

I haven't made any appreciable progress, though I have managed to replicate the Travis pkg_resources.DistributionNotFound: The 'leo===5.8.devel' distribution was not found error on my laptop so at least testing is faster. This Stack Overflow post indicates it might be a path not found problem: https://stackoverflow.com/questions/35457144/pkg-resources-distributionnotfound-when-using-a-module-installed-from-a-bdist-rp

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 20, 2018

Member

7bcbef9 might fix python setup.py install and running.

Remaining todo is remove the extra build only dependencies in line with PEP-518.

Member

maphew commented Sep 20, 2018

7bcbef9 might fix python setup.py install and running.

Remaining todo is remove the extra build only dependencies in line with PEP-518.

maphew added a commit that referenced this issue Sep 21, 2018

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 21, 2018

Member

@brobr ready for another test run. Travis (Ubuntu 14, python 2.7) is happy with this recipe:

# install Leo dependencies
pip install docutils nbformat pylint pyflakes pypandoc sphinx
sudo apt install tree python-qt4

# Install Leo in "distribution maintainer" mode
python setup.py install --root=/tmp/packages | grep -v '^copying'
    # hide too verbose 'Copying ...' messages

# ensure python knows where to find distrib-Leo
export PYTHONPATH=$PYTHONPATH:/tmp/packages/usr/lib/python2.7.14/site-packages

# Does distrib-Leo run?
/tmp/packages/home/travis/virtualenv/python2.7.14/bin/leo-console --version

What's significant:

  • old Windows specific binary config removed from setup.cfg
  • Packaging dependencies were moved from setup.py into pyproject.toml (PEP-518. Thank you @benoit-pierre!)

To do: Assuming the bug is indeed fixed - before merging into devel branch .travis.yml will need to modified to test pip install leo separately from python setup.py install

Member

maphew commented Sep 21, 2018

@brobr ready for another test run. Travis (Ubuntu 14, python 2.7) is happy with this recipe:

# install Leo dependencies
pip install docutils nbformat pylint pyflakes pypandoc sphinx
sudo apt install tree python-qt4

# Install Leo in "distribution maintainer" mode
python setup.py install --root=/tmp/packages | grep -v '^copying'
    # hide too verbose 'Copying ...' messages

# ensure python knows where to find distrib-Leo
export PYTHONPATH=$PYTHONPATH:/tmp/packages/usr/lib/python2.7.14/site-packages

# Does distrib-Leo run?
/tmp/packages/home/travis/virtualenv/python2.7.14/bin/leo-console --version

What's significant:

  • old Windows specific binary config removed from setup.cfg
  • Packaging dependencies were moved from setup.py into pyproject.toml (PEP-518. Thank you @benoit-pierre!)

To do: Assuming the bug is indeed fixed - before merging into devel branch .travis.yml will need to modified to test pip install leo separately from python setup.py install

@brobr

This comment has been minimized.

Show comment
Hide comment
@brobr

brobr Sep 23, 2018

Hi maphew, thanks for the ongoing work on this.

For my testing (on Slackware64-current) I use a standardized script which is basically doing the "python setup.py install" (If I could attach it somehow here, I would have done this; I used this template: https://www.slackbuilds.org/templates/python-template.SlackBuild ). After installing the created package Leo ends up in /usr/lib64/python2.7/site_packages/leo and the following commands end up in /usr/bin:


leo             leo-c           leo-console     leo-install.py  leo-m           leo-messages  

(Are they actually all needed to be there??? See below)

After that, when renaming my .leo folders and running leo from the console, it still hangs on above assertion error... ;-(

This is related to 'leo-m' or 'leo-messages', as these commands give an identical output as 'leo' by itself.

Leo 5.8 devel
Not running from a git repo
Python 2.7.15, PyQt version 5.7.1
linux2
** isPython3: False
..[cut a lot of lines]..
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 1994, in finishCreate
    f.top = g.app.gui.frameFactory.createFrame(f)
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 4495, in createFrame
    dw.construct(master=tabw)
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 110, in construct
    assert g.os_path_exists(ui_description_file)
AssertionError

Running leo-c or leo-console from a terminal ends with these errors:

bash-4.4$ leo-console
..[cut a lot of lines]..
  File "/usr/lib64/python2.7/site-packages/leo/plugins/cursesGui2.py", line 2783, in __init__
    super(LeoBody, self).__init__(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/leo/external/npyscreen/wgmultiline.py", line 90, in __init__
    self.height, str(self)))
npyscreen.wgwidget.NotEnoughSpaceForWidget: Height of 1 allocated. Not enough space allowed for <leo.plugins.cursesGui2.LeoBody object at 0x7f8cbb18b210>

With leo-install.py one gets this:

bash-4.4$ leo-install.py 
Traceback (most recent call last):
  File "/usr/bin/leo-install.py", line 32, in <module>
    if sys.argv[1] == '-install':
IndexError: list index out of range

Running 'python launchLeo.py' from the downloaded source folder (i.e. without compiling/installing the program system-wide) there is no problem; as if leo-m(essages) is bypassed.

hth

rob

PS. Is there a way of making a dependency as pypandoc less probelematic for a user when (py)pandoc has not been installed? WIthout it leo runs fine when started from its folder via launchLeo.py, but I had to edit it out of the setup.py as above in order to get the program to bypass the common module-not-found start-up error...

brobr commented Sep 23, 2018

Hi maphew, thanks for the ongoing work on this.

For my testing (on Slackware64-current) I use a standardized script which is basically doing the "python setup.py install" (If I could attach it somehow here, I would have done this; I used this template: https://www.slackbuilds.org/templates/python-template.SlackBuild ). After installing the created package Leo ends up in /usr/lib64/python2.7/site_packages/leo and the following commands end up in /usr/bin:


leo             leo-c           leo-console     leo-install.py  leo-m           leo-messages  

(Are they actually all needed to be there??? See below)

After that, when renaming my .leo folders and running leo from the console, it still hangs on above assertion error... ;-(

This is related to 'leo-m' or 'leo-messages', as these commands give an identical output as 'leo' by itself.

Leo 5.8 devel
Not running from a git repo
Python 2.7.15, PyQt version 5.7.1
linux2
** isPython3: False
..[cut a lot of lines]..
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 1994, in finishCreate
    f.top = g.app.gui.frameFactory.createFrame(f)
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 4495, in createFrame
    dw.construct(master=tabw)
  File "/usr/lib64/python2.7/site-packages/leo/plugins/qt_frame.py", line 110, in construct
    assert g.os_path_exists(ui_description_file)
AssertionError

Running leo-c or leo-console from a terminal ends with these errors:

bash-4.4$ leo-console
..[cut a lot of lines]..
  File "/usr/lib64/python2.7/site-packages/leo/plugins/cursesGui2.py", line 2783, in __init__
    super(LeoBody, self).__init__(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/leo/external/npyscreen/wgmultiline.py", line 90, in __init__
    self.height, str(self)))
npyscreen.wgwidget.NotEnoughSpaceForWidget: Height of 1 allocated. Not enough space allowed for <leo.plugins.cursesGui2.LeoBody object at 0x7f8cbb18b210>

With leo-install.py one gets this:

bash-4.4$ leo-install.py 
Traceback (most recent call last):
  File "/usr/bin/leo-install.py", line 32, in <module>
    if sys.argv[1] == '-install':
IndexError: list index out of range

Running 'python launchLeo.py' from the downloaded source folder (i.e. without compiling/installing the program system-wide) there is no problem; as if leo-m(essages) is bypassed.

hth

rob

PS. Is there a way of making a dependency as pypandoc less probelematic for a user when (py)pandoc has not been installed? WIthout it leo runs fine when started from its folder via launchLeo.py, but I had to edit it out of the setup.py as above in order to get the program to bypass the common module-not-found start-up error...

@edreamleo

This comment has been minimized.

Show comment
Hide comment
@edreamleo

edreamleo Sep 24, 2018

Member
Member

edreamleo commented Sep 24, 2018

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 24, 2018

Member

Thanks for the report.
And the thanks :-)

On linux leo-messages can be removed, it's only needed on Windows which won't report to console unless asked to. When broken things are fixed I'll look into intelligently installing it only where it makes sense. Additionally all short or long forms can be removed, e.g. choose one of leo-c or leo-console, they're just for convenience/clarity.

leo-install.py: I've lost track of when/where this comes into play and need to bring myself up to speed again. It's not needed in the pip workflow and I'd thought it was only for Windows.

pypandoc: yeah I'm not happy with this here. It should just be part of plugins, for document conversion. It's use in setup is to work around a limitation in pypi.org. ...later: which is fixed! yay - #980

Member

maphew commented Sep 24, 2018

Thanks for the report.
And the thanks :-)

On linux leo-messages can be removed, it's only needed on Windows which won't report to console unless asked to. When broken things are fixed I'll look into intelligently installing it only where it makes sense. Additionally all short or long forms can be removed, e.g. choose one of leo-c or leo-console, they're just for convenience/clarity.

leo-install.py: I've lost track of when/where this comes into play and need to bring myself up to speed again. It's not needed in the pip workflow and I'd thought it was only for Windows.

pypandoc: yeah I'm not happy with this here. It should just be part of plugins, for document conversion. It's use in setup is to work around a limitation in pypi.org. ...later: which is fixed! yay - #980

@farseerfc farseerfc referenced this issue Sep 25, 2018

Open

Python3.7 rebuild #832

23 of 24 tasks complete
@brobr

This comment has been minimized.

Show comment
Hide comment
@brobr

brobr Sep 25, 2018

Hi maphew thanks for the update. I see in my output that the windows specific scripts are installed here:

Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.8_devel-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leo-m script to /tmp/SBo/package-leo/usr/bin
Installing leo-console script to /tmp/SBo/package-leo/usr/bin
Installing leo-c script to /tmp/SBo/package-leo/usr/bin
Installing leo-messages script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin 

Removing the leo-m(essages) scripts from /usr/bin does not help in bypassing the AssertionError

On a working install of 5.7.3 none of the windows-specific stuff gets installed (note that 'running install scripts' is an output from the leo-package, independent of the script I am using to build the package):

Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.7.3-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leoc script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin

The leo-script is the same between either install (apart from a change in version no)
Absence of leoc does not interfere with starting leo (on a working install of 5.7.3)

brobr commented Sep 25, 2018

Hi maphew thanks for the update. I see in my output that the windows specific scripts are installed here:

Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.8_devel-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leo-m script to /tmp/SBo/package-leo/usr/bin
Installing leo-console script to /tmp/SBo/package-leo/usr/bin
Installing leo-c script to /tmp/SBo/package-leo/usr/bin
Installing leo-messages script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin 

Removing the leo-m(essages) scripts from /usr/bin does not help in bypassing the AssertionError

On a working install of 5.7.3 none of the windows-specific stuff gets installed (note that 'running install scripts' is an output from the leo-package, independent of the script I am using to build the package):

Copying leo.egg-info to /tmp/SBo/package-leo/usr/lib64/python2.7/site-packages/leo-5.7.3-py2.7.egg-info
running install_scripts
creating /tmp/SBo/package-leo/usr/bin
copying build/scripts-2.7/leo-install.py -> /tmp/SBo/package-leo/usr/bin
changing mode of /tmp/SBo/package-leo/usr/bin/leo-install.py to 755
Installing leoc script to /tmp/SBo/package-leo/usr/bin
Installing leo script to /tmp/SBo/package-leo/usr/bin

The leo-script is the same between either install (apart from a change in version no)
Absence of leoc does not interfere with starting leo (on a working install of 5.7.3)

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Sep 28, 2018

Member

With 0ac02d7 pypandoc isn't used in setup anymore.

With cb16261 we're choosy and only install Windows scripts on Windows.

Linux and Mac:

  • leo
  • leo-console, leo-c

Windows:

  • leo
  • leo-console, leo-c
  • leo-messages, leo-m
Member

maphew commented Sep 28, 2018

With 0ac02d7 pypandoc isn't used in setup anymore.

With cb16261 we're choosy and only install Windows scripts on Windows.

Linux and Mac:

  • leo
  • leo-console, leo-c

Windows:

  • leo
  • leo-console, leo-c
  • leo-messages, leo-m
@benoit-pierre

This comment has been minimized.

Show comment
Hide comment
@benoit-pierre

benoit-pierre Sep 28, 2018

Note: ideally, I should be able to build a wheel of your package on Linux and install it on Windows (since it's an universal wheel), for this reason, changing the entry-points based on the platform setup.py is executed on is not a good idea IMHO.

benoit-pierre commented Sep 28, 2018

Note: ideally, I should be able to build a wheel of your package on Linux and install it on Windows (since it's an universal wheel), for this reason, changing the entry-points based on the platform setup.py is executed on is not a good idea IMHO.

@benoit-pierre

This comment has been minimized.

Show comment
Hide comment
@benoit-pierre

benoit-pierre Sep 28, 2018

@maphew: there's an error in pyproject.toml btw; in the build dependencies key_ring is required instead of keyring.

benoit-pierre commented Sep 28, 2018

@maphew: there's an error in pyproject.toml btw; in the build dependencies key_ring is required instead of keyring.

@maphew

This comment has been minimized.

Show comment
Hide comment
@maphew

maphew Oct 1, 2018

Member

@benoit-pierre thanks for the feedback. keyring fixed. I'll follow up on the other in a new issue; this one's growing too many branches.

Member

maphew commented Oct 1, 2018

@benoit-pierre thanks for the feedback. keyring fixed. I'll follow up on the other in a new issue; this one's growing too many branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment