Repository: spack/spack

Issue:
Clingo bootstrap doesn't work on Gentoo
Gentoo has a python launcher to support it's slot system that gets used that seems to break clingo's bootstrap.  Specifically, it uses https://github.com/mgorny/python-exec.   The "real" pythons are installed to

```
/usr/lib/python-exec/python3.8/python
/usr/lib/python-exec/python3.9/python
```

I tried to override this by providing an external python with a path to the "real" python that doesn't use the wrapper, but that didn't work either.  I'm at a loss at how to work around this.

### Steps to reproduce the issue

```console
spack env create -d .
spack env activate
# modify spack.yaml to set conretizer to clingo
spack install zlib
...
```

### Error Message

<!-- If Spack reported an error, provide the error message. If it did not report an error but the output appears incorrect, provide the incorrect output. If there was no error message and no output but the result is incorrect, describe how it does not match what you expect. -->
```console
[runderwood@voyager z-checker2]$ spack --debug --stacktrace install zlib
lib/spack/spack/cmd/__init__.py:121 ==> [2021-07-16-11:13:21.836383] Imported install from built-in commands
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.840660] Reading config file /home/runderwood/git/play/z-checker2/spack.yaml
lib/spack/spack/cmd/__init__.py:121 ==> [2021-07-16-11:13:21.842890] Imported install from built-in commands
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.846059] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.849286] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/database.py:371 ==> [2021-07-16-11:13:21.867635] DATABASE LOCK TIMEOUT: 3s
lib/spack/spack/database.py:375 ==> [2021-07-16-11:13:21.867820] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.868322] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/database.py:371 ==> [2021-07-16-11:13:21.870098] DATABASE LOCK TIMEOUT: 3s
lib/spack/spack/database.py:375 ==> [2021-07-16-11:13:21.870261] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/bootstrap.py:201 ==> [2021-07-16-11:13:21.870435] [BOOTSTRAP CONFIG SCOPE] name=_builtin
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-11:13:21.870835] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/home/runderwood/git/contrib/spack/etc/spack/defaults
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-11:13:21.870988] [BOOTSTRAP CONFIG SCOPE] name=defaults/linux, path=/home/runderwood/git/contrib/spack/etc/spack/defaults/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-11:13:21.871151] [BOOTSTRAP CONFIG SCOPE] name=system, path=/etc/spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-11:13:21.871330] [BOOTSTRAP CONFIG SCOPE] name=system/linux, path=/etc/spack/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-11:13:21.871649] [BOOTSTRAP CONFIG SCOPE] name=site, path=/home/runderwood/git/contrib/spack/etc/spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-11:13:21.871871] [BOOTSTRAP CONFIG SCOPE] name=site/linux, path=/home/runderwood/git/contrib/spack/etc/spack/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-11:13:21.872074] [BOOTSTRAP CONFIG SCOPE] name=user, path=/home/runderwood/.spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-11:13:21.872231] [BOOTSTRAP CONFIG SCOPE] name=user/linux, path=/home/runderwood/.spack/linux
lib/spack/spack/bootstrap.py:268 ==> [2021-07-16-11:13:21.876701] [BOOTSTRAP ROOT SPEC] clingo: clingo-bootstrap@spack+python %gcc target=x86_64
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.877895] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.941592] diffutils applying constraint iconv
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.952648] ncurses applying constraint pkgconfig
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.954302] readline applying constraint ncurses
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.956690] gdbm applying constraint readline
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.960950] bzip2 applying constraint diffutils
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.963320] perl applying constraint gdbm
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.964517] perl applying constraint berkeley-db
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.965639] perl applying constraint bzip2+shared
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.966716] perl applying constraint zlib+shared
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.967988] bison applying constraint diffutils
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.970728] bison applying constraint m4
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.973103] bison applying constraint perl
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.974835] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.976131] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.978049] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.979282] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.980793] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:21.981883] clingo-bootstrap applying constraint python
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:21.983878] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/packages.yaml
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:22.023630] Reading config file /home/runderwood/.spack/packages.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.057308] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.058938] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.059929] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.060875] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.061438] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.066315] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.067270] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.068254] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.069135] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.069690] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.073763] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.074641] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.075545] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.076333] clingo-bootstrap applying constraint python
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:22.080690] Reading config file /home/runderwood/.spack/linux/compilers.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.133970] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.135174] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.136343] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-11:13:22.137266] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2488 ==> [2021-07-16-11:13:22.146638] Ordered hashes [cmake]: cmake/23/b48396c0e4f61756248156b6cebe9bc0d7a22228639b47b5aa77c9330588ce88
lib/spack/spack/spec.py:2488 ==> [2021-07-16-11:13:22.146861] Ordered hashes [python]: python/6/0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:22.215956] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/installer.py:1406 ==> [2021-07-16-11:13:22.268842] Initializing the build queue from the build requests
lib/spack/spack/installer.py:1020 ==> [2021-07-16-11:13:22.269017] Initializing the build queue for clingo-bootstrap
lib/spack/spack/installer.py:2147 ==> [2021-07-16-11:13:22.270963] Processing dependencies for clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he: ('build', 'link', 'run')
lib/spack/spack/installer.py:1885 ==> [2021-07-16-11:13:22.271175] Pkg id bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-11:13:22.271325] - clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/installer.py:1885 ==> [2021-07-16-11:13:22.284071] Pkg id cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-11:13:22.284706] - clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/installer.py:1885 ==> [2021-07-16-11:13:22.298703] Pkg id python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-11:13:22.298897] - clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/installer.py:1885 ==> [2021-07-16-11:13:22.327835] Pkg id re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-11:13:22.328239] - clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/database.py:476 ==> [2021-07-16-11:13:22.341519] Removing failure marking for clingo-bootstrap
lib/spack/spack/installer.py:1885 ==> [2021-07-16-11:13:22.342036] Pkg id clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he has the following dependents:
lib/spack/spack/installer.py:1412 ==> [2021-07-16-11:13:22.343251] Ensure all dependencies know all dependents across specs
lib/spack/spack/installer.py:323 ==> [2021-07-16-11:13:22.345730] bison@3.7.1 : externally installed in /usr
lib/spack/spack/installer.py:329 ==> [2021-07-16-11:13:22.346118] bison@3.7.1 : already registered in DB
[+] /usr (external bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-11:13:22.346419] Flagging bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-11:13:22.346624] Removing bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq from clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-11:13:22.346841] clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he: Removed bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq from uninstalled deps list: {'python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y', 're2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt', 'cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu'}
lib/spack/spack/installer.py:323 ==> [2021-07-16-11:13:22.347078] cmake@3.19.7 : externally installed in /usr
lib/spack/spack/installer.py:329 ==> [2021-07-16-11:13:22.347224] cmake@3.19.7 : already registered in DB
[+] /usr (external cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-11:13:22.347487] Flagging cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-11:13:22.347634] Removing cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu from clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-11:13:22.347820] clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he: Removed cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu from uninstalled deps list: {'python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y', 're2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt'}
lib/spack/spack/installer.py:323 ==> [2021-07-16-11:13:22.348046] python@3.9 : externally installed in /usr/lib/python-exec
lib/spack/spack/installer.py:329 ==> [2021-07-16-11:13:22.348194] python@3.9 : already registered in DB
[+] /usr/lib/python-exec (external python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-11:13:22.348385] Flagging python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-11:13:22.348550] Removing python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y from clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-11:13:22.348738] clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he: Removed python-3.9-cwu7hmf6jfwszsbpphpomv7drbfvh32y from uninstalled deps list: {'re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt'}
lib/spack/spack/installer.py:966 ==> [2021-07-16-11:13:22.349895] Acquiring a write lock on re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt with timeout 1e-09
lib/spack/spack/installer.py:1384 ==> [2021-07-16-11:13:22.350705] Flagging re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-11:13:22.350855] Removing re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt from clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-11:13:22.351023] clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he: Removed re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt from uninstalled deps list: set()
lib/spack/spack/stage.py:327 ==> [2021-07-16-11:13:22.352034] Creating stage lock spack-stage-re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt
lib/spack/spack/installer.py:982 ==> [2021-07-16-11:13:22.352241] Downgrading to a read lock on re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt with timeout 1e-09
[+] /home/runderwood/.spack/bootstrap/store/linux-gentoo2-x86_64/gcc-10.3.0/re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt
lib/spack/spack/installer.py:966 ==> [2021-07-16-11:13:22.352729] Acquiring a write lock on clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he with timeout 1e-09
lib/spack/spack/installer.py:1126 ==> [2021-07-16-11:13:22.354616] Installing clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/installer.py:394 ==> [2021-07-16-11:13:22.354771] Searching for binary cache of clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/config.py:989 ==> [2021-07-16-11:13:22.355315] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/mirrors.yaml
lib/spack/spack/binary_distribution.py:1430 ==> [2021-07-16-11:13:22.745648] Did not find linux-gentoo2-x86_64-gcc-10.3.0-clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he.spec.yaml on https://mirror.spack.io/build_cache/linux-gentoo2-x86_64-gcc-10.3.0-clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he.spec.yaml
  Download failed: HTTP Error 404: Not Found
lib/spack/spack/installer.py:282 ==> [2021-07-16-11:13:22.746939] No binary for clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he found: installing from source
lib/spack/spack/util/executable.py:190 ==> [2021-07-16-11:13:22.823209] '/usr/bin/git' 'describe' '--tags' '--match' 'v*'
lib/spack/spack/compilers/__init__.py:741 ==> [2021-07-16-11:13:22.954372] [TOOLCHAIN] MATCH Gcc
lib/spack/spack/build_environment.py:365 ==> [2021-07-16-11:13:22.956773] Adding compiler bin/ paths: /home/runderwood/git/contrib/spack/lib/spack/env /home/runderwood/git/contrib/spack/lib/spack/env/case-insensitive /home/runderwood/git/contrib/spack/lib/spack/env/gcc
lib/spack/spack/stage.py:327 ==> [2021-07-16-11:13:22.967005] Creating stage lock spack-stage-clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/error.py:54 ==> [2021-07-16-11:13:22.969505] Error: RuntimeError: Unable to locate python command in /usr/lib/python-exec/bin

/home/runderwood/git/contrib/spack/var/spack/repos/builtin/packages/python/package.py:660, in command:
        657                return Executable(path)
        658        else:
        659            msg = 'Unable to locate {0} command in {1}'
  >>    660            raise RuntimeError(msg.format(self.name, self.prefix.bin))


Traceback (most recent call last):
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/build_environment.py", line 1011, in _setup_pkg_and_run
    setup_package(pkg, dirty=kwargs.get('dirty', False),
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/build_environment.py", line 768, in setup_package
    set_wrapper_variables(pkg, env)
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/build_environment.py", line 424, in set_wrapper_variables
    update_compiler_args_for_dep(dspec)
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/build_environment.py", line 403, in update_compiler_args_for_dep
    dep_link_dirs.extend(query.libs.directories)
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/spec.py", line 949, in __get__
    value = f()
  File "/home/runderwood/git/contrib/spack/lib/spack/spack/spec.py", line 938, in <lambda>
    callbacks_chain.append(lambda: getattr(pkg, self.attribute_name))
  File "/home/runderwood/git/contrib/spack/var/spack/repos/builtin/packages/python/package.py", line 777, in libs
  File "/home/runderwood/git/contrib/spack/var/spack/repos/builtin/packages/python/package.py", line 695, in get_config_var
  File "/home/runderwood/git/contrib/spack/var/spack/repos/builtin/packages/python/package.py", line 661, in command
RuntimeError: Unable to locate python command in /usr/lib/python-exec/bin
lib/spack/spack/installer.py:1336 ==> [2021-07-16-11:13:22.970121] Flagging clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he as failed: RuntimeError: Unable to locate python command in /usr/lib/python-exec/bin
lib/spack/spack/stage.py:327 ==> [2021-07-16-11:13:22.972865] Creating stage lock spack-stage-clingo-bootstrap-spack-rygx3hggm5itz37tbf2wptnhggikt2he
lib/spack/spack/cmd/install.py:397 ==> [2021-07-16-11:13:22.973130] ChildError: RuntimeError: Unable to locate python command in /usr/lib/python-exec/bin
lib/spack/spack/main.py:777 ==> [2021-07-16-11:13:22.973268] ChildError: RuntimeError: Unable to locate python command in /usr/lib/python-exec/bin

```

### Information on your system

<!-- Please include the output of `spack debug report` -->

<!-- If you have any relevant configuration detail (custom `packages.yaml` or `modules.yaml`, etc.) you can add that here as well. -->

### Additional information

<!-- These boxes can be checked by replacing [ ] with [x] or by clicking them after submitting the issue. -->
- [x ] I have run `spack debug report` and reported the version of Spack/Python/Platform

```console
[runderwood@voyager z-checker2]$ spack debug report
* **Spack:** 0.16.2-3541-64f31c4579
* **Python:** 3.9.5
* **Platform:** linux-gentoo2-skylake
* **Concretizer:** clingo
```

- [x] I have searched the issues of this repo and believe this is not a duplicate
- [x] I have run the failing commands in debug mode and reported the output



Discussion:
@cosmicexplorer I think you work on Clingo boostrap?
Also as a follow up,  if I set the concretizer back to normal, I can install clingo without a problem.
With the following patch, I get past the build error, and get a different error

```diff
diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py
index 96f11b631d..9baced343a 100644
--- a/lib/spack/spack/bootstrap.py
+++ b/lib/spack/spack/bootstrap.py
@@ -54,7 +54,7 @@ def spack_python_interpreter():
     which Spack is currently running as the only Python external spec
     available.
     """
-    python_prefix = os.path.dirname(os.path.dirname(sys.executable))
+    python_prefix = os.path.abspath(sys.prefix)
     external_python = spec_for_current_python()
 
     entry = {
```

Here is the new error:

```console
[runderwood@voyager z-checker2]$ spack --debug --stacktrace install
lib/spack/spack/cmd/__init__.py:121 ==> [2021-07-16-13:18:24.331012] Imported install from built-in commands
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.334201] Reading config file /home/runderwood/git/play/z-checker2/spack.yaml
lib/spack/spack/cmd/__init__.py:121 ==> [2021-07-16-13:18:24.336829] Imported install from built-in commands
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.430499] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.434508] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/database.py:371 ==> [2021-07-16-13:18:24.452053] DATABASE LOCK TIMEOUT: 3s
lib/spack/spack/database.py:375 ==> [2021-07-16-13:18:24.452231] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.452740] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/bootstrap.yaml
lib/spack/spack/database.py:371 ==> [2021-07-16-13:18:24.454448] DATABASE LOCK TIMEOUT: 3s
lib/spack/spack/database.py:375 ==> [2021-07-16-13:18:24.454621] PACKAGE LOCK TIMEOUT: No timeout
lib/spack/spack/bootstrap.py:201 ==> [2021-07-16-13:18:24.454789] [BOOTSTRAP CONFIG SCOPE] name=_builtin
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-13:18:24.455181] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/home/runderwood/git/contrib/spack/etc/spack/defaults
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-13:18:24.455325] [BOOTSTRAP CONFIG SCOPE] name=defaults/linux, path=/home/runderwood/git/contrib/spack/etc/spack/defaults/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-13:18:24.455475] [BOOTSTRAP CONFIG SCOPE] name=system, path=/etc/spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-13:18:24.455611] [BOOTSTRAP CONFIG SCOPE] name=system/linux, path=/etc/spack/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-13:18:24.455751] [BOOTSTRAP CONFIG SCOPE] name=site, path=/home/runderwood/git/contrib/spack/etc/spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-13:18:24.455885] [BOOTSTRAP CONFIG SCOPE] name=site/linux, path=/home/runderwood/git/contrib/spack/etc/spack/linux
lib/spack/spack/bootstrap.py:213 ==> [2021-07-16-13:18:24.456026] [BOOTSTRAP CONFIG SCOPE] name=user, path=/home/runderwood/.spack
lib/spack/spack/bootstrap.py:214 ==> [2021-07-16-13:18:24.456158] [BOOTSTRAP CONFIG SCOPE] name=user/linux, path=/home/runderwood/.spack/linux
lib/spack/spack/bootstrap.py:268 ==> [2021-07-16-13:18:24.459697] [BOOTSTRAP ROOT SPEC] clingo: clingo-bootstrap@spack+python %gcc target=x86_64
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.460742] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.513965] diffutils applying constraint iconv
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.533957] ncurses applying constraint pkgconfig
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.534910] readline applying constraint ncurses
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.535877] gdbm applying constraint readline
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.539502] bzip2 applying constraint diffutils
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.541753] perl applying constraint gdbm
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.542737] perl applying constraint berkeley-db
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.543736] perl applying constraint bzip2+shared
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.544743] perl applying constraint zlib+shared
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.545747] bison applying constraint diffutils
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.546705] bison applying constraint m4
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.547670] bison applying constraint perl
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.549032] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.550266] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.552321] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.553576] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.554992] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.556084] clingo-bootstrap applying constraint python
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.558061] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/packages.yaml
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.582974] Reading config file /home/runderwood/.spack/packages.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.614529] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.616145] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.617126] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.618000] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.618562] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.623408] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.624355] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.625339] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.626215] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.626774] python applying constraint pkgconfig@0.9.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.630759] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.631826] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.633001] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.633887] clingo-bootstrap applying constraint python
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.638979] Reading config file /home/runderwood/.spack/linux/compilers.yaml
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.688799] clingo-bootstrap applying constraint cmake@3.16.0:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.689969] clingo-bootstrap applying constraint re2c@0.13:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.691027] clingo-bootstrap applying constraint bison@2.5:
lib/spack/spack/spec.py:2813 ==> [2021-07-16-13:18:24.691943] clingo-bootstrap applying constraint python
lib/spack/spack/spec.py:2488 ==> [2021-07-16-13:18:24.701211] Ordered hashes [cmake]: cmake/23/b48396c0e4f61756248156b6cebe9bc0d7a22228639b47b5aa77c9330588ce88
lib/spack/spack/spec.py:2488 ==> [2021-07-16-13:18:24.701449] Ordered hashes [python]: python/6/0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87
lib/spack/spack/config.py:989 ==> [2021-07-16-13:18:24.767907] Reading config file /home/runderwood/git/contrib/spack/etc/spack/defaults/config.yaml
lib/spack/spack/bootstrap.py:105 ==> [2021-07-16-13:18:24.816565] Warning: Spec clingo-bootstrap@spack%gcc@10.3.0~docs~ipo+python build_type=Release arch=linux-gentoo2-x86_64 ^python@3.9%gcc@10.3.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-gentoo2-x86_64 did not provide module clingo
lib/spack/spack/installer.py:1406 ==> [2021-07-16-13:18:24.819890] Initializing the build queue from the build requests
lib/spack/spack/installer.py:1020 ==> [2021-07-16-13:18:24.820056] Initializing the build queue for clingo-bootstrap
lib/spack/spack/installer.py:2147 ==> [2021-07-16-13:18:24.822003] Processing dependencies for clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy: ('build', 'link', 'run')
lib/spack/spack/installer.py:1885 ==> [2021-07-16-13:18:24.822223] Pkg id bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-13:18:24.822378] - clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/installer.py:1885 ==> [2021-07-16-13:18:24.834742] Pkg id cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-13:18:24.834931] - clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/installer.py:1885 ==> [2021-07-16-13:18:24.850021] Pkg id python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-13:18:24.850389] - clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/installer.py:1885 ==> [2021-07-16-13:18:24.882498] Pkg id re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt has the following dependents:
lib/spack/spack/installer.py:1888 ==> [2021-07-16-13:18:24.882689] - clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/installer.py:1885 ==> [2021-07-16-13:18:24.891878] Pkg id clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy has the following dependents:
lib/spack/spack/installer.py:1412 ==> [2021-07-16-13:18:24.892667] Ensure all dependencies know all dependents across specs
lib/spack/spack/installer.py:323 ==> [2021-07-16-13:18:24.894307] bison@3.7.1 : externally installed in /usr
lib/spack/spack/installer.py:329 ==> [2021-07-16-13:18:24.894509] bison@3.7.1 : already registered in DB
[+] /usr (external bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-13:18:24.894704] Flagging bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-13:18:24.894848] Removing bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq from clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-13:18:24.895021] clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy: Removed bison-3.7.1-unkbbf6hnv22mtzfrokpalc3eat5rbwq from uninstalled deps list: {'re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt', 'cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu', 'python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil'}
lib/spack/spack/installer.py:323 ==> [2021-07-16-13:18:24.895201] cmake@3.19.7 : externally installed in /usr
lib/spack/spack/installer.py:329 ==> [2021-07-16-13:18:24.895379] cmake@3.19.7 : already registered in DB
[+] /usr (external cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-13:18:24.895604] Flagging cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-13:18:24.895745] Removing cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu from clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-13:18:24.895909] clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy: Removed cmake-3.19.7-n5hux5ukgvkn3crkk2n6tox4mu76fqlu from uninstalled deps list: {'re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt', 'python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil'}
lib/spack/spack/installer.py:323 ==> [2021-07-16-13:18:24.896085] python@3.9 : externally installed in /usr
lib/spack/spack/installer.py:329 ==> [2021-07-16-13:18:24.896229] python@3.9 : already registered in DB
[+] /usr (external python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil)
lib/spack/spack/installer.py:1384 ==> [2021-07-16-13:18:24.896405] Flagging python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-13:18:24.896593] Removing python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil from clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-13:18:24.896752] clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy: Removed python-3.9-5bvbd24wdoueww6csye244kbfzyu2cil from uninstalled deps list: {'re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt'}
lib/spack/spack/installer.py:966 ==> [2021-07-16-13:18:24.897324] Acquiring a write lock on re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt with timeout 1e-09
lib/spack/spack/installer.py:1384 ==> [2021-07-16-13:18:24.897939] Flagging re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt as installed
lib/spack/spack/installer.py:1391 ==> [2021-07-16-13:18:24.898093] Removing re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt from clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy's uninstalled dependencies.
lib/spack/spack/installer.py:1992 ==> [2021-07-16-13:18:24.898261] clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy: Removed re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt from uninstalled deps list: set()
lib/spack/spack/stage.py:327 ==> [2021-07-16-13:18:24.899111] Creating stage lock spack-stage-re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt
lib/spack/spack/installer.py:982 ==> [2021-07-16-13:18:24.899319] Downgrading to a read lock on re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt with timeout 1e-09
[+] /home/runderwood/.spack/bootstrap/store/linux-gentoo2-x86_64/gcc-10.3.0/re2c-1.2.1-d4ai3o6hw7aw6lkcnc4nuj24zlrmxtgt
lib/spack/spack/installer.py:966 ==> [2021-07-16-13:18:24.899741] Acquiring a write lock on clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy with timeout 1e-09
lib/spack/spack/installer.py:1384 ==> [2021-07-16-13:18:24.900342] Flagging clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy as installed
lib/spack/spack/stage.py:327 ==> [2021-07-16-13:18:24.900981] Creating stage lock spack-stage-clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/installer.py:982 ==> [2021-07-16-13:18:24.901182] Downgrading to a read lock on clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy with timeout 1e-09
[+] /home/runderwood/.spack/bootstrap/store/linux-gentoo2-x86_64/gcc-10.3.0/clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy
lib/spack/spack/main.py:798 ==> [2021-07-16-13:18:24.903426] Error: cannot import module "clingo" from spec "clingo-bootstrap@spack%gcc@10.3.0~docs~ipo+python build_type=Release arch=linux-gentoo2-x86_64 ^bison@3.7.1%gcc@10.3.0 arch=linux-gentoo2-x86_64 ^cmake@3.19.7%gcc@10.3.0~doc+ncurses+openssl+ownlibs~qt build_type=Release patches=b48396c0e4f61756248156b6cebe9bc0d7a22228639b47b5aa77c9330588ce88 arch=linux-gentoo2-x86_64 ^python@3.9%gcc@10.3.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-gentoo2-x86_64 ^re2c@1.2.1%gcc@10.3.0 arch=linux-gentoo2-x86_64
```

And here is what got built:

```console
[runderwood@voyager clingo-bootstrap-spack-ir3fd2ec34trsblvrkknw4ni5t6qaiuy]$ tree
.
├── include
│   ├── clingo.h
│   └── clingo.hh
├── lib
│   └── python3.9
│       └── site-packages
│           ├── clingo
│           │   ├── ast.pyi
│           │   ├── __init__.pyi
│           │   ├── py.typed
│           │   └── types.pyi
│           └── clingo.cpython-39-x86_64-linux-gnu.so
└── lib64
    ├── cmake
    │   └── Clingo
    │       ├── ClingoConfig.cmake
    │       ├── ClingoConfigVersion.cmake
    │       ├── ClingoTargets.cmake
    │       └── ClingoTargets-release.cmake
    ├── libclingo.so -> libclingo.so.4
    ├── libclingo.so.4 -> libclingo.so.4.0
    └── libclingo.so.4.0

```

It seems that the build is not creating the right python shared object or loading it.  Using the original concretizer,  Here is what the install dir looks like:

```console
[runderwood@voyager clingo-bootstrap-5.5.0-tsfouzollindtc36m2hgfjii6rchy5mc]$ tree
.
├── include
│   ├── clingo.h
│   └── clingo.hh
├── lib
│   └── python3.8
│       └── site-packages
│           ├── clingo
│           │   ├── application.py
│           │   ├── ast.py
│           │   ├── backend.py
│           │   ├── _clingo.cpython-38-x86_64-linux-gnu.so
│           │   ├── configuration.py
│           │   ├── control.py
│           │   ├── core.py
│           │   ├── __init__.py
│           │   ├── _internal.py
│           │   ├── __main__.py
│           │   ├── propagator.py
│           │   ├── py.typed
│           │   ├── script.py
│           │   ├── solving.py
│           │   ├── statistics.py
│           │   ├── symbolic_atoms.py
│           │   ├── symbol.py
│           │   ├── theory_atoms.py
│           │   ├── theory.py
│           │   └── util.py
│           └── clingo-5.5.0.dist-info
│               ├── INSTALLER
│               └── METADATA
└── lib64
    ├── cmake
    │   └── Clingo
    │       ├── ClingoConfig.cmake
    │       ├── ClingoConfigVersion.cmake
    │       ├── ClingoTargets.cmake
    │       └── ClingoTargets-release.cmake
    ├── libclingo.so -> libclingo.so.4
    ├── libclingo.so.4 -> libclingo.so.4.0
    └── libclingo.so.4.0

9 directories, 31 files
```


I get a similar error message on my fedora 32 system:

```
$ spack spec -I python
Input spec
--------------------------------
 -   python

Concretized
--------------------------------
==> Warning: Spec clingo-bootstrap@spack%gcc@10.3.1~docs~ipo+python build_type=Release arch=linux-fedora32-x86_64 ^python@3.8%gcc@10.3.1+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-fedora32-x86_64 did not provide module clingo
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/libiconv-1.16-ffvwx2ep3wlnmhgv7ofqsbbl35ole7my
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/libsigsegv-2.13-xharjjhtrqigr2glr3wgwa74kpixps2i
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/berkeley-db-18.1.40-jdygarxexqca2g6edgndjinpup3ocgeo
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/pkgconf-1.7.4-my6wcmbphb4yqi64objbqs3gjq6idbpb
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/zlib-1.2.11-epqjbbeqmoinxuoeu6sxw424mjpp6sm6
[+] /usr (external python-3.8-nohqffyntqyw4iftrxo23yed3uxu6at4)
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/re2c-1.2.1-75l4iqsa3z3wwn2blbkrv5ajlluayhdp
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/diffutils-3.7-jebdvs4hlncacorwuyvty7akafe46756
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/m4-1.4.19-v2crk4inh66qscqvinidxhqtg47lqtvh
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/ncurses-6.2-es5x2ceg5p3rgjce633mtzwlrctgnazc
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/bzip2-1.0.8-btu3yh5gn6ent2rde3zpswpwq56kual3
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/readline-8.1-eag4saamsvaezumyexyzmqxsse2mkrwi
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/gdbm-1.19-v4qrvj6jb4l334aemerkil6cpa7pnonh
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/perl-5.34.0-enjomvxl3jt7maum7dryshouk77ampkf
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/openssl-1.1.1k-jzkppm4yvol2geluvzarvukwedvagiat
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/bison-3.7.6-fucz7xxciqr2k3gffngxug2emffnsbg3
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/cmake-3.20.5-n3a2by2jcvjjy5sdtfgxdwndhsu7uexc
[+] $HOME/.spack/bootstrap/store/linux-fedora32-x86_64/gcc-10.3.1/clingo-bootstrap-spack-6iwjzl74cqj2iwjogvqcan4w6pfk5taw
==> Error: cannot import module "clingo" from spec "clingo-bootstrap@spack%gcc@10.3.1~docs~ipo+python build_type=Release arch=linux-fedora32-x86_64 ^berkeley-db@18.1.40%gcc@10.3.1+cxx~docs+stl patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-fedora32-x86_64 ^bison@3.7.6%gcc@10.3.1 arch=linux-fedora32-x86_64 ^bzip2@1.0.8%gcc@10.3.1~debug~pic+shared arch=linux-fedora32-x86_64 ^cmake@3.20.5%gcc@10.3.1~doc+ncurses+openssl+ownlibs~qt build_type=Release arch=linux-fedora32-x86_64 ^diffutils@3.7%gcc@10.3.1 arch=linux-fedora32-x86_64 ^gdbm@1.19%gcc@10.3.1 arch=linux-fedora32-x86_64 ^libiconv@1.16%gcc@10.3.1 arch=linux-fedora32-x86_64 ^libsigsegv@2.13%gcc@10.3.1 arch=linux-fedora32-x86_64 ^m4@1.4.19%gcc@10.3.1+sigsegv arch=linux-fedora32-x86_64 ^ncurses@6.2%gcc@10.3.1~symlinks+termlib abi=none arch=linux-fedora32-x86_64 ^openssl@1.1.1k%gcc@10.3.1~docs+systemcerts arch=linux-fedora32-x86_64 ^perl@5.34.0%gcc@10.3.1+cpanm+shared+threads arch=linux-fedora32-x86_64 ^pkgconf@1.7.4%gcc@10.3.1 arch=linux-fedora32-x86_64 ^python@3.8%gcc@10.3.1+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-fedora32-x86_64 ^re2c@1.2.1%gcc@10.3.1 arch=linux-fedora32-x86_64 ^readline@8.1%gcc@10.3.1 arch=linux-fedora32-x86_64 ^zlib@1.2.11%gcc@10.3.1+optimize+pic+shared arch=linux-fedora32-x86_64
```
spack debug report
* **Spack:** 0.16.2-3697-ac2444f1d5
* **Python:** 3.8.10
* **Platform:** linux-fedora32-haswell
* **Concretizer:** clingo

In addition I had the problem as well on a debian 9 system. Somehow I managed to get it to work there by checking out a new clone and removing the `~/.spack` directory (rm ~/.spack alone did not do work). Then the original clone did work again. 
On the fedora system this "trick" did not work.
@manuelakuhn It's a bug due to #24095 Short version is that `clingo` is installed correctly, but Spack computes the wrong directory to add to PYTHONPATH. I'll work on a fix to it asap.
Thank you!

Resolving patch:
diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py
--- a/lib/spack/spack/bootstrap.py
+++ b/lib/spack/spack/bootstrap.py
@@ -92,15 +92,19 @@ def make_module_available(module, spec=None, install=False):
     installed_specs = spack.store.db.query(spec, installed=True)
 
     for ispec in installed_specs:
-        # TODO: make sure run-environment is appropriate
-        module_path = ispec['python'].package.get_python_lib(prefix=ispec.prefix)
+        lib_spd = ispec['python'].package.default_site_packages_dir
+        lib64_spd = lib_spd.replace('lib/', 'lib64/')
+        module_paths = [
+            os.path.join(ispec.prefix, lib_spd),
+            os.path.join(ispec.prefix, lib64_spd)
+        ]
         try:
-            sys.path.append(module_path)
+            sys.path.extend(module_paths)
             __import__(module)
             return
         except ImportError:
             tty.warn("Spec %s did not provide module %s" % (ispec, module))
-            sys.path = sys.path[:-1]
+            sys.path = sys.path[:-2]
 
     def _raise_error(module_name, module_spec):
         error_msg = 'cannot import module "{0}"'.format(module_name)
@@ -117,13 +121,18 @@ def _raise_error(module_name, module_spec):
         spec.concretize()
     spec.package.do_install()
 
-    module_path = spec['python'].package.get_python_lib(prefix=spec.prefix)
+    lib_spd = spec['python'].package.default_site_packages_dir
+    lib64_spd = lib_spd.replace('lib/', 'lib64/')
+    module_paths = [
+        os.path.join(spec.prefix, lib_spd),
+        os.path.join(spec.prefix, lib64_spd)
+    ]
     try:
-        sys.path.append(module_path)
+        sys.path.extend(module_paths)
         __import__(module)
         return
     except ImportError:
-        sys.path = sys.path[:-1]
+        sys.path = sys.path[:-2]
         _raise_error(module, spec)
 
 
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -920,8 +920,12 @@ def site_packages_dir(self):
         try:
             return self.get_python_lib(prefix='')
         except (ProcessError, RuntimeError):
-            return os.path.join(
-                'lib', 'python{0}'.format(self.version.up_to(2)), 'site-packages')
+            return self.default_site_packages_dir
+
+    @property
+    def default_site_packages_dir(self):
+        python_dir = 'python{0}'.format(self.version.up_to(2))
+        return os.path.join('lib', python_dir, 'site-packages')
 
     @property
     def easy_install_file(self):


Test patch: