|
| 1 | +# Installing your own copy of desc-python |
| 2 | + |
| 3 | +Using [conda-lock](https://github.com/conda/conda-lock) you can quickly and easily install your own copy of most DESC conda environments where lock files are available. |
| 4 | + |
| 5 | +## At NERSC |
| 6 | + |
| 7 | +`conda-lock` is available for all DESC members at NERSC, just add `$CFS/lsst/utilities/bin`to your PATH |
| 8 | + |
| 9 | +`export PATH=$CFS/lsst/utilities/bin:$PATH` |
| 10 | + |
| 11 | +In this example we will install a copy of `desc-python`. |
| 12 | + |
| 13 | +git clone https://github.com/LSSTDESC/desc-python.git` |
| 14 | + |
| 15 | +To use the current production version of `desc-python`, let us assume $curBuildDir points to your desired installation directory |
| 16 | + |
| 17 | +```bash |
| 18 | +cp desc-python/conda/sitecustomize.py $curBuildDir |
| 19 | +cp desc-python/conda/desc-py-lock.yml $curBuildDir |
| 20 | +cp desc-python/conda/pip.config $curBuildDir |
| 21 | +cd $curBuildDir |
| 22 | + |
| 23 | +module unload python |
| 24 | +module unload cray-libsci |
| 25 | +module load cray-mpich-abi/8.1.30 |
| 26 | +export CONDA_PKGS_DIRS=$curBuildDir/pkgs |
| 27 | + |
| 28 | +# use your own copy of Miniforge or you could use NERSC's python module |
| 29 | +url="https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" |
| 30 | +curl -LO "$url" |
| 31 | + |
| 32 | +bash ./Miniforge3-Linux-x86_64.sh -b -p $curBuildDir/py |
| 33 | +source $curBuildDir/py/etc/profile.d/conda.sh |
| 34 | +conda activate base |
| 35 | + |
| 36 | +export PIP_CONFIG_FILE=$curBuildDir/pip.config |
| 37 | + |
| 38 | +conda-lock install --mamba -n my-desc-python $curBuildDir/desc-py-lock.yml |
| 39 | + |
| 40 | +conda activate my-desc-python |
| 41 | + |
| 42 | +conda env config vars set CSL_DIR=${CONDA_PREFIX}/cosmosis-standard-library |
| 43 | +cd ${CONDA_PREFIX} |
| 44 | +source ${CONDA_PREFIX}/bin/cosmosis-configure |
| 45 | +cosmosis-build-standard-library main |
| 46 | +``` |
| 47 | + |
| 48 | +And that's it! |
| 49 | + |
| 50 | +#### To use your my-desc-python environment |
| 51 | + |
| 52 | +```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 |
| 58 | +``` |
| 59 | + |
| 60 | + |
0 commit comments