Repository: spack/spack

Issue:
Installation issue: py-scipy with Blis and Flame
### Steps to reproduce the issue

Hi everyone (and the maintainers of the py-scipy @adamjstewart  @rgommers)
I have a problem appearing when I try to install py-scipy using AMDBlis (and AMDlibflame) as dependency, and a similar error appears installing py-scipy using Blis (and libflame).

After perfectly installing AMDBlis and AMDlibflame as

`spack install amdblis threads=openmp`
`spack install amdlibflame^amdblis threads=openmp`

If I try to install py-scipy, after installing correctly all the other packages, during the phase "install" i obtain the error (more in detail later):

`scipy/meson.build:131:0: ERROR: Dependency "blis-mt" not found, tried pkgconfig and cmake`

A similar error happens, for example, when I install scipy having Blis and libflame as 

`spack install blis`
`spack install libflame^blis`

where in this case the dependency not found is different, and I have the error

`scipy/meson.build:132:0: ERROR: Dependency "flame" not found, tried pkgconfig and cmake`


### Error message

Installing py-scipy-1.9.3-5q2zwez4ev2zc2mwhaymii2kxu4ydzs4
==> No binary for py-scipy-1.9.3-5q2zwez4ev2zc2mwhaymii2kxu4ydzs4 found: installing from source
==> Using cached archive: /software/spack/var/spack/cache/_source-cache/archive/fb/fbc5c05c85c1a02be77b1ff591087c83bc44579c6d2bd9fb798bb64ea5e1a027.tar.gz
==> No patches needed for py-scipy
==> py-scipy: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
    '/software/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.4.0/meson-0.64.0-icly3vurwtgjcv7ewsk6borzufhw5eap/bin/meson' 'setup' 'build' '-Dblas=blis-mt' '-Dlapack=flame' '--prefix=/tmp/root/spack-stage/spack-stage-py-scipy-1.9.3-5q2zwez4ev2zc2mwhaymii2kxu4ydzs4/spack-src/build-install' '-Ddebug=false' '-Doptimization=2'

1 error found in build log:
     39    |   Support for all CMake versions below 3.17.0 will be removed once
     40    |   newer CMake versions are more widely adopted. If you encounter
     41    |   any errors please try upgrading CMake to a newer version first.
     42    
     43    Run-time dependency blis-mt found: NO (tried pkgconfig and cmake)
     44    
  >> 45    scipy/meson.build:131:0: ERROR: Dependency "blis-mt" not found, tried pkgconfig and cmake
     46    
     47    A full log can be found at /tmp/root/spack-stage/spack-stage-py-scipy-1.9.3-5q2zwez4ev2zc2mwhaymii2kxu4ydzs4/spack-src/build/meson-logs/meson-log.txt


### Information on your system

Up to now, the default configuration files have not been modified.

Outcome of spack debug report:
```
* **Spack:** 0.20.0.dev0 (4bf964e6b36e8756b014c2e30343507c1cb71b03)
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-zen2
* **Concretizer:** clingo
```


### Additional information

[meson_log.txt](https://github.com/spack/spack/files/10106916/meson_log.txt)

Thanks for your time.

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
SciPy uses Meson for building now, and looks up the BLAS dependency using pkg-config with these config options.

> `'-Dblas=blis-mt' '-Dlapack=flame'`

Seems like Blis does provide one, but it's called blis.pc, so passing the Meson configuration as `-Dblas=blis` should work. I don't know enough about spack to answer how it calculates this as `blis-mt`.
> I don't know enough about spack to answer how it calculates this as `blis-mt`.

Spack's `py-scipy` package queries `spec["blas"].libs.names[0]`, which resolves to `spec["blis"].libs.names[0]`, which searches for `libblis` and `libblis-mt` in the installation prefix. It seems like the order is non-deterministic, so it's getting `blis-mt` instead. I'll hardcode it to use `blis`.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/py-scipy/package.py b/var/spack/repos/builtin/packages/py-scipy/package.py
--- a/var/spack/repos/builtin/packages/py-scipy/package.py
+++ b/var/spack/repos/builtin/packages/py-scipy/package.py
@@ -182,19 +182,14 @@ def install(self, spec, prefix):
         blas = spec["blas"].libs.names[0]
         lapack = spec["lapack"].libs.names[0]
         # FIXME: MKL support doesn't work, why?
-        if (
-            spec["blas"].name == "intel-mkl"
-            or spec["blas"].name == "intel-parallel-studio"
-            or spec["blas"].name == "intel-oneapi-mkl"
-        ):
+        if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]:
             blas = "mkl-dynamic-lp64-seq"
-        if (
-            spec["lapack"].name == "intel-mkl"
-            or spec["lapack"].name == "intel-parallel-studio"
-            or spec["lapack"].name == "intel-oneapi-mkl"
-        ):
+        if spec["lapack"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]:
             lapack = "mkl-dynamic-lp64-seq"
 
+        if spec["blas"].name in ["blis", "amdblis"]:
+            blas = "blis"
+
         args = [
             "setup",
             "build",


Test patch: