Skip to content

Environments reread, which complicates scripting #25532

@haampie

Description

@haampie

Steps to reproduce

Create an env in cd $(mktemp -d):

spack:
  view: true
  specs: [zlib]
  config:
    install_tree:
      root: ./here

Run spack python

In [1]: from spack.environment import Environment, activate
In [2]: e = Environment(".")
In [3]: activate(e)
In [4]: e.concretize()
In [5]: e.install_all()
In [6]: e.all_specs()
Out[7]: []

And all_specs() is empty, because install_all() rereads the spack.yaml file from disk right here:

with self.write_transaction():

and no spack.lock was stored because I didn't call e.write() anywhere.

It'd be great if these simple operations did not depend on the filesystem at all... Clearly views write to the environment, but arbitrarily "clearing" the current environment and de-serializing it from disk is very unexpected.

Error message

none

Information on your system

  • Spack: 0.16.2-3959-220a87812c
  • Python: 3.8.11
  • Platform: linux-ubuntu20.04-zen2
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageThe issue needs to be prioritized

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions