spack: Leftover /.spack/spec.yaml from failed installations
I’m trying to uninstall all of my installed packages. The process uninstalls a few hundred packages and then crashes with:
KeyError: 'libffi'
Steps to reproduce the issue
$ spack uninstall -ay
...
==> Error: Unable to read file: /Users/Adam/spack/opt/spack/darwin-catalina-x86_64/clang-11.0.3-apple/py-chardet-3.0.4-gqaa2mw2vk7fpx32f7fsmqh56i5daxp6/.spack/spec.yaml
Cause: 'libffi'
Error Message
$ spack -d uninstall -ay
...
Traceback (most recent call last):
File "/Users/Adam/spack/bin/spack", line 64, in <module>
sys.exit(spack.main.main())
File "/Users/Adam/spack/lib/spack/spack/main.py", line 760, in main
return _invoke_command(command, parser, args, unknown)
File "/Users/Adam/spack/lib/spack/spack/main.py", line 488, in _invoke_command
return_val = command(parser, args)
File "/Users/Adam/spack/lib/spack/spack/cmd/uninstall.py", line 348, in uninstall
uninstall_specs(args, specs)
File "/Users/Adam/spack/lib/spack/spack/cmd/uninstall.py", line 323, in uninstall_specs
do_uninstall(env, uninstall_list, args.force)
File "/Users/Adam/spack/lib/spack/spack/cmd/uninstall.py", line 225, in do_uninstall
item.do_uninstall(force=force)
File "/Users/Adam/spack/lib/spack/spack/package.py", line 1769, in do_uninstall
Package.uninstall_by_spec(self.spec, force)
File "/Users/Adam/spack/lib/spack/spack/package.py", line 1741, in uninstall_by_spec
spack.hooks.pre_uninstall(spec)
File "/Users/Adam/spack/lib/spack/spack/hooks/__init__.py", line 59, in __call__
hook(*args, **kwargs)
File "/Users/Adam/spack/lib/spack/spack/hooks/extensions.py", line 18, in pre_uninstall
if pkg.is_activated(view):
File "/Users/Adam/spack/lib/spack/spack/package.py", line 1030, in is_activated
exts = extensions_layout.extension_map(self.extendee_spec)
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 431, in extension_map
return self._extension_map(spec).copy()
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 456, in _extension_map
by_hash = self.layout.specs_by_hash()
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 361, in specs_by_hash
for spec in self.all_specs():
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 343, in all_specs
return [self.read_spec(s) for s in spec_files]
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 343, in <listcomp>
return [self.read_spec(s) for s in spec_files]
File "/Users/Adam/spack/lib/spack/spack/directory_layout.py", line 230, in read_spec
spec = spack.spec.Spec.from_yaml(f)
File "/Users/Adam/spack/lib/spack/spack/spec.py", line 1939, in from_yaml
return Spec.from_dict(data)
File "/Users/Adam/spack/lib/spack/spack/spec.py", line 1926, in from_dict
deps[name]._add_dependency(deps[dname], dtypes)
KeyError: 'libffi'
Information on your system
- Spack: 0.14.2-979-7e5874c250
- Python: 3.7.6
- Platform: darwin-catalina-ivybridge
Additional information
Could be related to #3690, but a completely different error message. Unfortunately, this isn’t fixed by #16447.
@aweits @alalazo may be interested in this.
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (17 by maintainers)
@adamjstewart I could reproduce with a fresh clone and
zlib:Thanks!
That spec.yaml is definitely malformed (i.e. should not have been generated by
Spec.to_yaml). As for how it got into that state could be considered a secondary matter:spack uninstallshould be robust enough to remove the prefix even if the Spec is malformed, so I’ll add something tomorrow to allow for that.See my second comment above
That could be related, these must have been created before
tensorflowwas renamed topy-tensorflow.To be clear, that should be OK, I’m just trying to brainstorm how this inconsistent state would be reached.