Skip to content

module 'spack.hooks' has no attribute 'sbang' #20005

@eugeneswalker

Description

@eugeneswalker

Trying to install some packages from build cache is giving this error:

  • module 'spack.hooks' has no attribute 'sbang'

Using

  • spack@develop
  • c417827
  • Thu Nov 19 17:43:52 2020 +0100
  • Docker container ecpe4s/ubuntu18.04-runner-x86_64:2020-09-01

Concrete spec: kokkos-p3br7p.yml.txt

Use this config.yaml:

config:
  install_tree:
    root: /spack-software
    padded_length: 64

Setup Spack this way:

$> git clone https://github.com/spack/spack /builds/uo/e4s/spack

$> (cd /builds/uo/e4s/spack && git checkout c417827)

$> spack mirror add E4S https://cache.e4s.io

$> wget https://oaciss.uoregon.edu/e4s/e4s.pub

$> spack gpg trust e4s.pub

$> spack config edit config
# use the config.yaml pasted above

Install fails:

$> spack install --cache-only -f ./kokkos-p3br7p.yml
==> Installing kokkos-3.2.00-2ryuvoz7s4zl7pjmcd5egs6oev2bgcfk
==> Fetching https://cache.e4s.io/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/kokkos-3.2.00/linux-ubuntu18.04-x86_64-gcc-7.5.0-kokkos-3.2.00-2ryuvoz7s4zl7pjmcd5egs6oev2bgcfk.spack
################################################################################################################################################## 100.0%
==> Extracting kokkos-3.2.00-2ryuvoz7s4zl7pjmcd5egs6oev2bgcfk from binary cache
gpgconf: socketdir is '/run/user/0/gnupg'
gpg: Signature made Thu 19 Nov 2020 06:51:21 PM UTC
gpg:                using RSA key 7D344E2992071B0AAAE1EDB0E68DE2A80314303D
gpg: Good signature from "prl" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D34 4E29 9207 1B0A AAE1  EDB0 E68D E2A8 0314 303D
[+] /spack-software/spack_path_placeholder/spack_path_placeholder/sp/linux-ubuntu18.04-x86_64/gcc-7.5.0/kokkos-3.2.00-2ryuvoz7s4zl7pjmcd5egs6oev2bgcfk
==> Error: Failed to install kokkos due to AttributeError: module 'spack.hooks' has no attribute 'sbang'
==> Error: module 'spack.hooks' has no attribute 'sbang'

Install fails w/ stack trace:

$> spack -d install --cache-only -f ./kokkos-p3br7p.yml
...
==> [2020-11-19-20:22:34.676428] Flagging kokkos-3.2.00-2ryuvoz7s4zl7pjmcd5egs6oev2bgcfk as failed: module 'spack.hooks' has no attribute 'sbang'
==> [2020-11-19-20:22:34.677820] Error: Failed to install kokkos due to AttributeError: module 'spack.hooks' has no attribute 'sbang'
Traceback (most recent call last):
  File "/builds/uo/e4s/spack/bin/spack", line 66, in <module>
    sys.exit(spack.main.main())
  File "/builds/uo/e4s/spack/lib/spack/spack/main.py", line 762, in main
    return _invoke_command(command, parser, args, unknown)
  File "/builds/uo/e4s/spack/lib/spack/spack/main.py", line 490, in _invoke_command
    return_val = command(parser, args)
  File "/builds/uo/e4s/spack/lib/spack/spack/cmd/install.py", line 370, in install
    install_specs(args, kwargs, zip(abstract_specs, specs))
  File "/builds/uo/e4s/spack/lib/spack/spack/cmd/install.py", line 212, in install_specs
    builder.install()
  File "/builds/uo/e4s/spack/lib/spack/spack/installer.py", line 1496, in install
    self._install_task(task)
  File "/builds/uo/e4s/spack/lib/spack/spack/installer.py", line 1064, in _install_task
    full_hash_match):
  File "/builds/uo/e4s/spack/lib/spack/spack/installer.py", line 276, in _install_from_cache
    spack.hooks.post_install(pkg.spec)
  File "/builds/uo/e4s/spack/lib/spack/spack/hooks/__init__.py", line 59, in __call__
    hook(*args, **kwargs)
  File "/builds/uo/e4s/spack/lib/spack/spack/hooks/module_file_generation.py", line 30, in post_install
    _for_each_enabled(spec, 'write')
  File "/builds/uo/e4s/spack/lib/spack/spack/hooks/module_file_generation.py", line 22, in _for_each_enabled
    getattr(generator, method_name)()
  File "/builds/uo/e4s/spack/lib/spack/spack/modules/common.py", line 819, in write
    context = self.context.to_dict()
  File "/builds/uo/e4s/spack/lib/spack/spack/tengine.py", line 63, in to_dict
    d = [(name, getattr(self, name)) for name in self.context_properties]
  File "/builds/uo/e4s/spack/lib/spack/spack/tengine.py", line 63, in <listcomp>
    d = [(name, getattr(self, name)) for name in self.context_properties]
  File "/builds/uo/e4s/spack/lib/spack/spack/modules/common.py", line 672, in environment_modifications
    build_environment.set_module_variables_for_package(self.spec.package)
  File "/builds/uo/e4s/spack/lib/spack/spack/build_environment.py", line 539, in set_module_variables_for_package
    _set_variables_for_single_module(pkg, mod)
  File "/builds/uo/e4s/spack/lib/spack/spack/build_environment.py", line 482, in _set_variables_for_single_module
    m.std_cmake_args = spack.build_systems.cmake.CMakePackage._std_args(pkg)
  File "/builds/uo/e4s/spack/lib/spack/spack/build_systems/cmake.py", line 170, in _std_args
    if pkg.spec.satisfies('^[email protected]:'):
  File "/builds/uo/e4s/spack/lib/spack/spack/spec.py", line 3108, in satisfies
    return self.satisfies_dependencies(other, strict=deps_strict)
  File "/builds/uo/e4s/spack/lib/spack/spack/spec.py", line 3141, in satisfies_dependencies
    if not self[name].satisfies(other[name], deps=False):
  File "/builds/uo/e4s/spack/lib/spack/spack/spec.py", line 3395, in __getitem__
    return SpecBuildInterface(value, name, query_parameters)
  File "/builds/uo/e4s/spack/lib/spack/spack/spec.py", line 954, in __init__
    is_virtual = spack.repo.path.is_virtual(name)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 713, in is_virtual
    return have_name and pkg_name in self.provider_index
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 571, in provider_index
    self._provider_index.merge(repo.provider_index)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 981, in provider_index
    return self.index['providers']
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 403, in __getitem__
    self._build_all_indexes()
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 418, in _build_all_indexes
    self.indexes[name] = self._build_index(name, indexer)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 448, in _build_index
    indexer.update(namespaced_name)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 330, in update
    if spack.repo.path.is_virtual(name, use_index=False):
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 716, in is_virtual
    self.get_pkg_class(pkg_name).virtual)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 679, in get_pkg_class
    return self.repo_for_pkg(pkg_name).get_pkg_class(pkg_name)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 1126, in get_pkg_class
    module = self._get_pkg_module(pkg_name)
  File "/builds/uo/e4s/spack/lib/spack/spack/repo.py", line 1099, in _get_pkg_module
    prepend=_package_prepend)
  File "/builds/uo/e4s/spack/lib/spack/spack/util/imp/importlib_importer.py", line 48, in load_source
    return loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 823, in load_module
  File "<frozen importlib._bootstrap_external>", line 682, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 684, in _load
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/builds/uo/e4s/spack/var/spack/repos/builtin/packages/gobject-introspection/package.py", line 8, in <module>

AttributeError: module 'spack.hooks' has no attribute 'sbang'

There is no problem if I change SPACK_ROOT to /builds/uo/e4s/spac !!! I think this is a big clue... Why would the value of $SPACK_ROOT affect whether or not a package can import spack.hooks.sbang ?

Additionally, moving the import spack.hooks.sbang as sbang out of global-scope and into method-scope as is done in the following commit solves this problem , although I expect this would just push the ball further down the road.

@becker33 @scheibelp @tgamblin

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbuildcachee4secptriageThe issue needs to be prioritized

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions