Hi Cormac,

On 19 Dec 2013, at 23:47, Garvey, Cormac T wrote:

> Hi All,
> On the Easybuild wiki page "Setting up own easyblock repository", it 
> instructs to
> put __init__.py in the easybuild directory (e.g touch 
> $MYEBDIR/easybuild/__init__.py).
> 
> When I do that I get the following easybuild error.
> 
> Traceback (most recent call last):
> File 
> "/hpc-common/software/easybuild/1.9.0/gcc/opt/lib/python2.7/site-packages/easybuild/main.py",
>  line 80, in <module>
>   from easybuild.tools.build_log import  EasyBuildError, print_msg, 
> print_error, print_warning
> ImportError: No module named tools.build_log
> 
> Removing __init__.py from the $MYEBDIR/easybuild directory works (i.e My 
> easyblocks can co-exist with the default Easybuild 
> easyblocks.)

When you say things work when you simply remove the __init__.py, is EasyBuils 
still able to find your 'private' easyblocks?
I.e., does "eb --list-easyblocks" include your easyblocks as well (they really 
shouldn't, I would be really surprised if they are)?

The __init__.py really needs to be there to declare the 'easybuild' namespace, 
such that 'from easybuild.easyblocks.foo import EB_Foo' can work (with Foo a 
private easyblock).

There is one nasty detail though, and I guess you're being bitten by this. The 
path with your private easyblocks needs to be added *last* to $PYTHONPATH, 
rather than first.
This is also described on the "Setting up your own easyblock repository" wiki 
page at 
https://github.com/hpcugent/easybuild/wiki/Setting-up-your-own-easyblocks-repository:

"Note: You need to add the path to your easyblocks at the end, not at the 
beginning (see below as to why)."

The reason why is also explained on that page, but it boils down to use 
flattening the easyblocks namespace from e.g. 'easybuild.easyblocks.g.gcc' to 
'easybuid,easyblocks.gcc'.
This trick only works *once* though, and only when your easybuild.easyblocks 
namespace is first in $PYTHONPATH.

I hope this helps, do let us know how this works out.


regards,

Kenneth

Reply via email to