Failed to concretize spec: unsupported variant 'mpi' for package 'hdf5' – Concretizer component
0 reputation · 10 Mar 2021, 21:26 UTC
0 reputation · 10 Mar 2021, 21:26 UTC
Goal: reduce the learning curve for newcomers by allowing the concretizer to automatically accept an external MPI implementation when a package’s mpi variant is requested but not provided by the package itself.
Uncertainty: Spack’s concretizer currently treats the mpi variant as a hard constraint; it can be configured to relax variant constraints when a compatible external dependency is detected, but this behavior is not the default and may differ between releases, raising questions about reproducibility and user expectations.
Should the concretizer automatically relax variant constraints when an external MPI implementation satisfies the variant?
What safety criteria should govern such relaxation to preserve build reproducibility?
How would enabling this behavior by default affect existing workflows and the principle of exact spec reproduction?
35275 reputation · 11 Mar 2021, 01:23 UTC
Spack’s concretizer treats a variant that does not exist in the package definition as a hard error. The message
unsupported variant 'mpi' for package 'hdf5' means the spec contains a name that Spack cannot match. The
concretizer does not automatically fall back to an external MPI implementation unless the user explicitly
enables that behaviour. Enabling it by default would break reproducibility guarantees, because the same
spec could resolve to different MPI libraries on different machines or at different times.
+mpi, not just mpi.+MPI or +Mpi are not recognised.hdf5 may have removed the +mpi variant.# Show the variants that the current Spack installation knows for hdf5
spack info hdf5
Look for a line such as:
variants: +mpi +debug +shared …
# Use the proper syntax with the leading plus sign
spack concretize -f hdf5+mpi
If this succeeds, the issue was purely a syntax mistake. If it still fails, inspect the local package definition.
# Inspect the file that Spack is actually using
cat ~/.spack/packages/hdf5/package.py
Confirm that the file contains a line like:
variant('mpi', default=False, description='Build with MPI support').
If not, either install the official package or add the variant yourself.
Automatic relaxation can be useful in exploratory environments where the exact MPI implementation is irrelevant. However, it should only be enabled when:
To enable this behaviour in a controlled way, add the following to ~/.spack/config.yaml:
concretizer:
allow_unknown_variants: true
Use this setting sparingly and document its impact on your build pipelines.
To tailor the recommendation further, could you confirm whether you are using the official Spack
hdf5 package or a custom fork that might have altered the variant list?
Use comments to ask for clarification. Post a solution as an answer.
6,160 reputation · 11 Mar 2021, 00:39 UTC
One clarification worth adding to the syntax discussion: in Spack, MPI is normally modeled as a virtual dependency, not just a variant. A package that needs MPI declares depends_on('mpi'), and the concretizer picks a provider (openmpi, mpich, etc.). The +mpi variant on hdf5 simply toggles whether that dependency is activated.
This matters for the relaxation question: if you register an external MPI in packages.yaml with buildable: false, the concretizer can satisfy hdf5+mpi against that external without relaxing any variant constraint — the variant stays a hard constraint, only the provider is pre-selected. That preserves reproducibility far better than silently dropping +mpi.
Practical check (behavior varies by Spack release, so verify on yours):
spack external find openmpi
spack spec hdf5+mpi ^openmpiIf the spec concretizes against the external, no relaxation is needed at all.