how to install packages into /usr/local

405 views
Skip to first unread message

Reid Priedhorsky

unread,
Mar 27, 2020, 3:39:58 PM3/27/20
to Spack
Folks,

I would like to use Spack to install things into standard paths such as /usr/local, without segregating all packages into their own directories. This is because I am in a container and I want to use the programs installed by Spack outside Spack, e.g. build other stuff with Spack-installed cmake.

Reading the docs, the obvious thing to do is set in config.yaml:

install_tree: /usr/local
install_path_scheme: ""

but this has no effect. I tried config.yaml in both my anonymous environment and editing $spack/etc/spack/defaults.config.yaml using sed. In both cases, "spack config get config" reports in part:

install_tree: /usr/local
install_path_scheme: ''

as I expected.

What is the expected behavior here?
How can I tell Spack to just install everything under /usr/local?

This is develop, commit 3f861e1, which I know is old, but I want to understand the expected behavior before I try upgrading, because upgrading is often quite disruptive for us.

Thanks,
Reid

Erik Schnetter

unread,
Mar 27, 2020, 7:20:10 PM3/27/20
to Reid Priedhorsky, Spack
Reid

I would use "spack view" for this. This makes copies or hardlinks to a
common directory, just as you need. For reference, I use

spack view -d true -e python hardlink -i $HOME/cactusdeps cactusdeps

to copy the package "cactusdeps" and all its dependencies (-d true),
excluding all Python files (-e python), to "$HOME/cactusdeps". Since
these are just hardlinks, I can also wipe "$HOME/cactusdeps" and
create a new view whenever I want, although I wouldn't expect that to
be useful in a container.

-erik
> --
> You received this message because you are subscribed to the Google Groups "Spack" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to spack+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/spack/107530e3-a2fd-4736-ac39-c4f698b2167d%40googlegroups.com.



--
Erik Schnetter <schn...@gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/

Gamblin, Todd

unread,
Mar 27, 2020, 7:27:22 PM3/27/20
to Erik Schnetter, Reid Priedhorsky, Spack
Reid:

To add to this, have you seen what `spack containerize` does for this? In the generated recipe, there’s a view in /opt/view. I think it would make sense to just set the view to /usr/local if you want things to appear to be in a separate prefix there.

We don’t have support in Spack for *installing* to combined directories — If I have dependencies like this:

A -> B, C
D -> B

And if B and C are installed in the same directory, there’s no way to build D with just B now. D’s build will always be polluted by C.

We do allow you to link everything into a common directory (a “view”) — either symlinks or hard links. Environments build all that for you automatically so you don’t have to use the `spack view` command (which is more like plumbing).

-Todd
> To view this discussion on the web visit https://groups.google.com/d/msgid/spack/CADKQjjf9a-jBTERA%2Bd--Fa23F3WobaBbWGxg%3DVui3%2BBx_1hwTA%40mail.gmail.com.

Gamblin, Todd

unread,
Mar 27, 2020, 7:30:08 PM3/27/20
to Gamblin, Todd, Erik Schnetter, Reid Priedhorsky, Spack
I forgot to send a link: https://spack.readthedocs.io/en/latest/containers.html

I think you’ve seen this — there are also a few PRs hat build on it:

If we merge 15028 is that going to help?

-Todd

Priedhorsky, Reid

unread,
Mar 30, 2020, 12:19:08 PM3/30/20
to Spack
Eric, Todd:

Thank you; this is helpful. I think the key is the “spack view” concept, which I was not familiar with. I will try this and report back.

For context:

1. We aren’t using “spack containerize”; this is manual use of Spack within a Dockerfile. Perhaps in the future we will try it using “spack containerize”. So, I have no opinion on PR #15028.

2. We are currently using an anonymous environment, though maybe I’ve messed it up somehow, because it did not seem to put the Spack tools in $PATH (e.g., “cmake”). Because it’s in a container, however, I would like to move away from activating any environment or modules. I’ve managed to get the environment activated using $BASH_ENV, but the method is clunky and perhaps buggy (see above).

Thanks,
Reid

he/his

Gamblin, Todd

unread,
Mar 30, 2020, 12:31:44 PM3/30/20
to Priedhorsky, Reid, Spack
Thanks Reid.

RE:
2. We are currently using an anonymous environment, though maybe I’ve messed it up somehow, because it did not seem to put the Spack tools in $PATH (e.g., “cmake”). Because it’s in a container, however, I would like to move away from activating any environment or modules. I’ve managed to get the environment activated using $BASH_ENV, but the method is clunky and perhaps buggy (see above).

If you’re already using an anonymous environment, you should be able to put:

view: /usr/local

To get the environment’s view created in /usr/local.  Let me know if you have issues

-Todd


-- 
You received this message because you are subscribed to the Google Groups "Spack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spack+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages