Repository: spack/spack

Issue:
Installation issue: vtk@9.0.3+python
### Steps to reproduce the issue

After installing `vtk@9.0.3+python`, the python vtk module is not found in the path:
```
$ spack install vtk@9.0.3+python
$ spack load vtk@9.0.3+python
$ python
>>> import vtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'vtk'
```

### Information on your system

* **Spack:** 0.16.3-4507-32b5669e8d
* **Python:** 3.8.11
* **Platform:** linux-fedora32-haswell
* **Concretizer:** clingo

### Additional information

A similar problem was resolved in #17126 but seem to have reappeared again.

```
$ spack cd -i vtk@9.0.3
$ ls lib/python3.8/site-packages  # empty
$ ls lib64/python3.8/site-packages 
mpi4py/  vtkmodules/  vtk.py
```
```
$ spack load vtk@9.0.3 
$ echo $PYTHONPATH
$spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/py-mpi4py-3.0.3-fvdbmna4xa3viokrmzaveq33vy6hh2ef/lib/python3.8/site-packages:$spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/vtk-9.0.3-5dmwd4bxvlvgv5zrgvfj6plobjsxbw2x/lib/python3.8/site-packages:$spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/py-mpi4py-3.0.3-fvdbmna4xa3viokrmzaveq33vy6hh2ef/lib/python3.8/site-packages
```


To compare the result to the other issue I tried to install `vtk@8.2.0+python` as well but it failed with the error message
```
1 error found in build log:
     242    -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
     243    -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
     244    -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
     245    -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
     246    -- Performing Test COMPILER_HAS_DEPRECATED_ATTR
     247    -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
  >> 248    CMake Error at $spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/cmake-3.21.3-76wvmpk75pk7tgz
            njnd7spneulakglkm/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
     249      Could NOT find HDF5 (missing: HDF5_HL_LIBRARIES)
     250    Call Stack (most recent call first):
     251      $spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/cmake-3.21.3-76wvmpk75pk7tgznjnd7spneulak
            glkm/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
     252      $spack/opt/spack/linux-fedora32-haswell/gcc-10.3.1/cmake-3.21.3-76wvmpk75pk7tgznjnd7spneulak
            glkm/share/cmake-3.21/Modules/FindHDF5.cmake:1001 (find_package_handle_standard_args)
     253      CMake/FindHDF5.cmake:9 (include)
     254      CMake/vtkModuleMacros.cmake:891 (find_package)
```
If I should open a additional issue for the second problem, let me know.

@chuckatkins @danlipsa 
@adamjstewart

### 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:
Does VTK have a way to specify which directory to install the Python libraries to? If not, we may need to override `setup_run_environment` to add the correct directory.
Adding `'-DCMAKE_INSTALL_LIBDIR:PATH=lib'` installs all libraries into lib (no lib64 usage). I have tested it on linux-fedora32-haswell and linux-debian9-piledriver and it solves the problem for me. I will open a pull request for it.

For the problem with 8.2.0 I will open another issue.
@adamjstewart This seems to be a regression as @manuelakuhn pointed out this was already solved at the spack level in  #17126 
Or rather it was solved in https://github.com/spack/spack/pull/18523


Resolving patch:
diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py
--- a/var/spack/repos/builtin/packages/vtk/package.py
+++ b/var/spack/repos/builtin/packages/vtk/package.py
@@ -144,6 +144,10 @@ def cmake_args(self):
             '-DBUILD_SHARED_LIBS=ON',
             '-DVTK_RENDERING_BACKEND:STRING={0}'.format(opengl_ver),
 
+            # prevents installation into lib64 which might not be in the path
+            # (solves #26314)
+            '-DCMAKE_INSTALL_LIBDIR:PATH=lib',
+
             # In general, we disable use of VTK "ThirdParty" libs, preferring
             # spack-built versions whenever possible
             '-DVTK_USE_SYSTEM_LIBRARIES:BOOL=ON',


Test patch: