cbg-ethz / shorah

Repo for the software suite ShoRAH (Short Reads Assembly into Haplotypes)
GNU General Public License v3.0
39 stars 14 forks source link

Restore custom install of exe files #48

Closed ozagordi closed 6 years ago

ozagordi commented 6 years ago

This was deleted by mistake in a previous PR. It is now possible to install shorah after building. Build first with meson build; cd build; ninja. Then, in the project root folder, pip install . will move the exe files and install shorah package. For development of python code one can use or pip install -e .

DrYak commented 6 years ago

I'm trying to test your branch, but I must be doing something wrong :

I can't understand why I can't successfully use your meson setup.

(But otherwise, tests pass)

ozagordi commented 6 years ago

What about pip install -e ./?

DrYak commented 6 years ago

with the -e option :

(Which I think should make sense for "Install a project in editable mode from a local project path", stuff is supposed to remain in the project directory ?)

DrYak commented 6 years ago

(Also indirectly related to the setuptools reworking : now shorah insist on looking for binaries in a bin subdir of its module, but autotools are still installing them in $(prefix)/bin, not $(PYTHONPATH)/shorah/bin)

ozagordi commented 6 years ago

With -e the code is supposed to remain in the project directory, yes. This is convenient in development: any change in the code can immediately be tested, no need to install after every edit.

I don't really understand why $(srcdir)/src/shorah/bin is not populated by pip install ., the code seems correct to me. I will give another look.

Where to put binaries is crucial here! My python code looks into $(srcdir)/src/shorah/bin/ only. If we keep autotools, they end up somewhere else. I will think of an alternative from the Python side.

DrYak commented 6 years ago

A viable alternative in python would be to fallback to normal $PATH searches (or use $PATH first). So that it also works with packages from conda, RPMs, etc.

Or an autotool alternative would be to them creat a symblink in $(PYTHONPATH)/shorah/bin pointing to $(srcdir)/src/shorah/bin (so literally ../../../../bin/ to make it position independent).

But otherwise this PR doesn't break anything existing, so it can be merged as soon as you're happy with it.

ozagordi commented 6 years ago

Just opened #51. Looking in src/shorah/bin first, and in PATH if executables are not there. I only tested it with pip install -e ./, not with autotools.

DrYak commented 6 years ago

I think the problem you had in the other thread might just be related to this "c++ bin file not getting copied as expected" issue.

DrYak commented 6 years ago

With the latest e0df210 merge, in autotool-mode everything works as it should (installed in a fresh new prefix, amplicon test example passes), without any manual linking needed.

DrYak commented 6 years ago

With the latest e0df210 merge, in meson + pip, production build, it still craps out with :

Traceback (most recent call last):
  File "/home/dryak/project/shorah/test-meson/bin/shorah", line 11, in <module>
    load_entry_point('ShoRAH==1.1.4.dev7+ge0df210', 'console_scripts', 'shorah')()
  File "/home/dryak/miniconda3/envs/shorah/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/dryak/miniconda3/envs/shorah/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
    return ep.load()
  File "/home/dryak/miniconda3/envs/shorah/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2408, in load
    return self.resolve()
  File "/home/dryak/miniconda3/envs/shorah/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2414, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'shorah'
DrYak commented 6 years ago

With the latest e0df210 merge, in meson + pip, debug build, and adding a ninja install step :

    meson --prefix=${PREFIX} build ;
    pushd build ;
    ninja 
    ninja install
    popd
    PYTHONPATH=${PREFIX}/lib/python3.6/site-packages/ pip install --prefix ${PREFIX} -e .

everything works similarly to auto-tools (with shorah picking up the c++ bins from ${PREFIX}/bin), (amplicon test example passes again, in yet another fresh prefix).

(I mean, passes while displaying giant walls of debugging information, as expected from a debug build)

DrYak commented 6 years ago

So basically, the branch is in a mergeable state without breaking much things (Autotool work as expected, meson works for editable/debug installs).

But somewhat meson/pip production builds are still breaking.

ozagordi commented 6 years ago

Let’s merge this and declutter a bit the PRs. I will look into meson + pip in another branch.