-
Notifications
You must be signed in to change notification settings - Fork 203
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
Using "--include-*" makes EB distributed classes in the same namespace unavailable for import #1677
Comments
ps. Looks like the module search path gets mangled here: > /local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_framework-2.7.0.dev0-py2.6.egg/easybuild/tools/include.py(273)include_toolchains()
-> reload(easybuild.toolchains)
(Pdb) p sys.path
['/local/z00/cma900/tmp/eb-36DhGQ/included-toolchains', '/local/z00/cma900/tmp/eb-36DhGQ/included-module-naming-schemes', '', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/distribute-0.7.3-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/setuptools-20.3-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/vsc_install-0.9.19-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_framework-2.7.0.dev0-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/vsc_base-2.4.18-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_easyblocks-2.7.0.dev0-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_easyconfigs-2.7.0.dev0-py2.6.egg', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib64/python2.6/site-packages/gtk-2.0', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']
(Pdb) p sys.modules['easybuild.toolchains'].__path__
['/local/z00/cma900/tmp/eb-36DhGQ/included-toolchains/easybuild/toolchains', '/local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_framework-2.7.0.dev0-py2.6.egg/easybuild/toolchains']
(Pdb) n
> /local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_framework-2.7.0.dev0-py2.6.egg/easybuild/tools/include.py(274)include_toolchains()
-> easybuild.toolchains.__path__.insert(0, os.path.join(toolchains_path, 'easybuild', 'toolchains'))
(Pdb) p sys.modules['easybuild.toolchains'].__path__
['/local/z00/cma900/tmp/eb-36DhGQ/included-toolchains/easybuild/toolchains']
(Pdb) n
> /local/z00/easybuild/software/EasyBuild/2.7.0.dev0/lib/python2.6/site-packages/easybuild_framework-2.7.0.dev0-py2.6.egg/easybuild/tools/include.py(275)include_toolchains()
-> for subpkg in toolchain_subpkgs:
(Pdb) p sys.modules['easybuild.toolchains'].__path__
['/local/z00/cma900/tmp/eb-36DhGQ/included-toolchains/easybuild/toolchains', '/local/z00/cma900/tmp/eb-36DhGQ/included-toolchains/easybuild/toolchains'] |
Thanks for reporting this, I ran into it the other day but didn't have the time to source the problem (and I think your python fu is better than mine). For reference here was my gist https://gist.github.com/ocaisa/2294ee06303e5b5c3016 |
Funny thing is I get different errors with the two different version of setuptools:
|
@ocaisa what are the setuptools versions?
|
system is 0.9.8, I updated GC3Pie to use 20.3 |
Does the fact that the error in both cases says |
@ocaisa The error message is wrong, it always says "Failed to import easyblock" (see the |
@chrisacbr Thanks for the detailed description, I'm able to reproduce this too now... |
The error is being thrown in |
I think the problem is that The blank entry in |
Should we also be inserting at position 1 rather than 0 so the current dir always has preference? |
Not a final solution, but this patch seems to resolve the problem. I'm still figuring out i) why the diff --git a/easybuild/tools/include.py b/easybuild/tools/include.py
index 7f596c9..f4867ea 100644
--- a/easybuild/tools/include.py
+++ b/easybuild/tools/include.py
@@ -177,9 +177,9 @@ def include_easyblocks(tmpdir, paths):
# make sure easybuild.easyblocks(.generic) are imported;
# reload them to pick up all possible paths they may be in
import easybuild.easyblocks
- reload(easybuild.easyblocks)
+ #reload(easybuild.easyblocks)
import easybuild.easyblocks.generic
- reload(easybuild.easyblocks.generic)
+ #reload(easybuild.easyblocks.generic)
# hard inject location to included (generic) easyblocks into Python search path
# only prepending to sys.path is not enough due to 'declare_namespace' in easybuild/easyblocks/__init__.py
@@ -217,7 +217,7 @@ def include_module_naming_schemes(tmpdir, paths):
# inject path into Python search path, and reload modules to get it 'registered' in sys.modules
sys.path.insert(0, mns_path)
fixup_namespace_packages(mns_path)
- reload(easybuild.tools.module_naming_scheme)
+ #reload(easybuild.tools.module_naming_scheme)
# hard inject location to included module naming schemes into Python search path
# only prepending to sys.path is not enough due to 'declare_namespace' in module_naming_scheme/__init__.py
@@ -267,11 +267,11 @@ def include_toolchains(tmpdir, paths):
# reload toolchain modules and hard inject location to included toolchains into Python search path
# only prepending to sys.path is not enough due to 'declare_namespace' in toolchains/*/__init__.py
- reload(easybuild.toolchains)
+ #reload(easybuild.toolchains)
easybuild.toolchains.__path__.insert(0, os.path.join(toolchains_path, 'easybuild', 'toolchains'))
for subpkg in toolchain_subpkgs:
tcpkg = 'easybuild.toolchains.%s' % subpkg
- reload(sys.modules[tcpkg])
+ #reload(sys.modules[tcpkg])
sys.modules[tcpkg].__path__.insert(0, os.path.join(toolchains_path, 'easybuild', 'toolchains', subpkg))
# sanity check: verify that included toolchain modules can be imported (from expected location) |
A pull request with a fix for this problem is provided in #1679. @chrisacbr If would be great if you can confirm this fix. |
@boegel Yep, works for me now. Thanks very much! |
@chrisacbr Thanks for the confirmation, PR #1679 is merged, so closing this issue. |
Given the following custom toolchain class:
In EasyBuild 2.6.0 the following succeeds:
But in the development version (deployed using the latest bootstrap script with source tarballs from github) it fails with:
The
toolchains
package namespace search path appears to be missing the original module path and instead has the temporary path listed twice:Similarily, MNS import fails as well:
This is on a CentOS 6 system:
Cc: @ocaisa
The text was updated successfully, but these errors were encountered: