Skip to content

Unable to concretize environment if python isn't installed yet #13529

@adamjstewart

Description

@adamjstewart

Spack Environments crashes when you try to concretize/update an environment that contains Python, but Python hasn't been installed yet.

Steps to reproduce the issue

$ cd foo  # directory containing spack.yaml
$ spack install

Error Message

==> Updating view at /mnt/a/u/sciteam/stewart1/crop_classification/.spack-env/view
Traceback (most recent call last):
  File "/u/sciteam/stewart1/spack/bin/spack", line 64, in <module>
    sys.exit(spack.main.main())
  File "/mnt/a/u/sciteam/stewart1/spack/lib/spack/spack/main.py", line 653, in main
    ev.activate(env, args.use_env_repo)
  File "/mnt/a/u/sciteam/stewart1/spack/lib/spack/spack/environment.py", line 163, in activate
    cmds += env.add_default_view_to_shell(shell)
  File "/mnt/a/u/sciteam/stewart1/spack/lib/spack/spack/environment.py", line 1074, in add_default_view_to_shell
    spec, self.default_view))
  File "/mnt/a/u/sciteam/stewart1/spack/lib/spack/spack/environment.py", line 1055, in environment_modifications_for_spec
    spec, context='run'
  File "/mnt/a/u/sciteam/stewart1/spack/lib/spack/spack/build_environment.py", line 759, in modifications_from_dependencies
    dpkg.setup_dependent_package(pkg.module, spec)
  File "/mnt/a/u/sciteam/stewart1/spack/var/spack/repos/builtin/packages/python/package.py", line 729, in setup_dependent_package
    module.setup_py = Executable(
  File "/mnt/a/u/sciteam/stewart1/spack/var/spack/repos/builtin/packages/python/package.py", line 526, in command

RuntimeError: Unable to locate python command in /mnt/a/u/sciteam/stewart1/spack/opt/spack/cray-cnl5-interlagos/gcc-5.3.0/python-3.7.4-6qsrqzoxsh2tvcsoyfec5gdfibgtlsiq/bin

The problem is that Python is not yet installed, so the installation directory does not exist, and spec['python'].command crashes.

Information on your system

Cray CNL5, GCC 5.3.0

spack.yaml:

spack:
  specs:
  - gdal+python
  - [email protected]:+sqlite3
  - py-flake8
  - py-matplotlib
  - py-numpy
  - py-pandas
  - '[email protected]:'
  - py-scikit-learn
  - '[email protected]:'
  - '[email protected]:'
  - '[email protected]:'
  - py-torchvision
  concretization: together

@becker33 I believe this is related to #13249. Spack is trying to run setup_run_environment even for packages that are not yet installed, causing this crash.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions