-
Notifications
You must be signed in to change notification settings - Fork 2
/
stage3-py.sh
executable file
·69 lines (57 loc) · 2.33 KB
/
stage3-py.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
set -e
#This commented-out bit, plus changing the definition of LOADRSPSTACK in
# Dockerfile.template, will clone the environment rather than installing
# into the stack environment itself. This adds 60% or so to the container
# size.
#
# source ${LOADSTACK}
# rspname="rsp-${LSST_CONDA_ENV_NAME}"
# mamba create --name ${rspname} --clone ${LSST_CONDA_ENV_NAME}
#
source ${LOADRSPSTACK}
# Mamba is compatible with conda, but much faster
if [ -z "$(which mamba)" ]; then
conda install -y mamba
fi
# Never allow the installation to upgrade rubin_env. Generally enforcing
# the pin is only needed for releases, where the current version may have
# moved ahead.
rubin_env_ver=$(mamba list rubin-env$ --no-banner --json \
| jq -r '.[0].version')
# Do the rest of the installation.
mamba install --no-banner -y \
"rubin-env-rsp==${rubin_env_ver}"
# Force newer firefly. Unnecessary when rubin-env >= 9.0.0 appears.
mamba install --no-banner -y 'firefly-client>=3'
# As with conda->mamba, uv is compatible with pip but much faster. It
# matters less here, of course, because there are many fewer
# pip-installed packages.
pip install uv
# These are the things that are not available on conda-forge.
# Note that we are not installing with `--upgrade`. That is so that if
# lower-level layers have already installed the package, pinned to a version
# they need, we won't upgrade it. But if it isn't already installed, we'll
# just take the latest available. `--no-build-isolation` ensures that any
# source packages use C++ libraries from conda-forge.
# "--no-build-isolation" means we're also responsible for the dependencies
# not already provided by something in the conda env. In this case,
# structlog and symbolicmode from lsst-rsp.
uv pip install --no-build-isolation \
rsp-jupyter-extensions \
jupyter-firefly-extensions \
'lsst-rsp>=0.5.1' \
structlog \
'symbolicmode<3'
# Add stack kernel
python3 -m ipykernel install --name 'LSST'
# Remove "system" kernel
stacktop="/opt/lsst/software/stack/conda/current"
rm -rf ${stacktop}/envs/${LSST_CONDA_ENV_NAME}/share/jupyter/kernels/python3
# Clear mamba, pip, and uv caches
mamba clean -a -y --no-banner
pip cache purge
uv cache clean
# Create package version docs.
uv pip freeze > ${verdir}/requirements-stack.txt
mamba env export > ${verdir}/conda-stack.yml