Skip to content

Commit 86ebbda

Browse files
authored
Merge pull request #176 from LSSTDESC/doc-april2026
Clean up conda-lock install and update setup_current_python.sh to sup…
2 parents f081ed6 + 99ce27f commit 86ebbda

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

doc/Installing-Your-Own-Env.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,27 @@ Using [conda-lock](https://github.com/conda/conda-lock) you can quickly and easi
1010

1111
In this example we will install a copy of `desc-python`.
1212

13-
git clone https://github.com/LSSTDESC/desc-python.git`
14-
1513
To use the current production version of `desc-python`, let us assume $curBuildDir points to your desired installation directory
1614

1715
```bash
16+
git clone https://github.com/LSSTDESC/desc-python.git`
1817
cp desc-python/conda/sitecustomize.py $curBuildDir
1918
cp desc-python/conda/desc-py-lock.yml $curBuildDir
2019
cp desc-python/conda/pip.config $curBuildDir
2120
cd $curBuildDir
2221
2322
module unload python
23+
module load cpu
2424
module unload cray-libsci
2525
module load cray-mpich-abi/8.1.30
2626
export CONDA_PKGS_DIRS=$curBuildDir/pkgs
2727
28-
# use your own copy of Miniforge or you could use NERSC's python module
28+
# use your own copy of Miniforge
2929
url="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
3030
curl -LO "$url"
3131
3232
bash ./Miniforge3-Linux-x86_64.sh -b -p $curBuildDir/py
33-
source $curBuildDir/py/etc/profile.d/conda.sh
34-
conda activate base
33+
source $curBuildDir/py/bin/activate
3534
3635
export PIP_CONFIG_FILE=$curBuildDir/pip.config
3736
@@ -49,12 +48,15 @@ And that's it!
4948
5049
#### To use your my-desc-python environment
5150
51+
Create two environment variables. `DESCUSERENV_DIR` should point to your conda installation's directory that contains `bin` and `DESCUSERENV_NAME` should be the name of your conda environment.
52+
5253
```bash
53-
module unload python
54-
module unload cray-libsci
55-
module load cray-mpich-abi/8.1.30
56-
source $curBuildDir/bin/activate
57-
conda activate my-desc-python
54+
export DESCUSERENV_DIR=$curBuildDir/py
55+
export DESCUSERENV_NAME=my-desc-python
5856
```
5957

58+
Now you can source setup_current_python.sh as usual, and your installation will be initialized
6059

60+
```bash
61+
source /global/comon/software/lsst/common/miniconda/setup_current_python.sh
62+
```

jupyter-kernels/setup/setup_current_python.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ fi
4242

4343
unset PYTHONHOME
4444
unset PYTHONPATH
45-
export PYTHONNOUSERSITE=' '
4645

47-
48-
source $DESC_INST_DIR/$DESC_PYTHON_VER/bin/activate
49-
conda activate desc-python
50-
51-
if [ -n "$DESCUSERENV" ]; then
52-
conda activate $DESCUSERENV
46+
if [ -n "$DESCUSERENV_DIR" ]; then
47+
source $DESCUSERENV_DIR/bin/activate
48+
conda activate $DESCUSERENV_NAME
49+
else
50+
source $DESC_INST_DIR/$DESC_PYTHON_VER/bin/activate
51+
conda activate desc-python
52+
export PYTHONNOUSERSITE=' '
53+
export PYTHONPATH=$PYTHONPATH:$DESC_INST_DIR/$DESC_PYTHON_VER
5354
fi
5455

5556
# COSMOSIS Setup
@@ -73,8 +74,6 @@ if [ -n "$DESCPYTHONPATH" ]; then
7374
echo "Including user python path: $DESCPYTHONPATH"
7475
fi
7576

76-
export PYTHONPATH=$PYTHONPATH:$DESC_INST_DIR/$DESC_PYTHON_VER
77-
7877
# Set this after conda environment is setup
7978
python_ver_major=$(python -c 'import sys; print(sys.version_info.major)')
8079
python_ver_minor=$(python -c 'import sys; print(sys.version_info.minor)')
@@ -88,7 +87,7 @@ if [ -n "$DESCPYTHONUSERBASE" ]; then
8887
echo "using DESCPYTHONUSERBASE: $DESCPYTHONUSERBASE"
8988
fi
9089

91-
export FIRECROWN_DIR=$CONDA_PREFIX/lib/python3.12/site-packages
90+
export FIRECROWN_DIR=$CONDA_PREFIX/lib/python$DESCPYTHONVER/site-packages
9291

9392
OUTPUTPY="$(which python)"
9493
echo Now using "${OUTPUTPY}"

0 commit comments

Comments
 (0)