Skip to content

Commit

Permalink
Reinstate install-conda code w/ EnvironmentLocationNotFound avoidance
Browse files Browse the repository at this point in the history
  • Loading branch information
leehart committed Nov 15, 2024
1 parent 726d7a9 commit 8ffa098
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions install-conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,29 @@ fi
ENVPINNED=${MGENVDIR}/environment-pinned-${OS}.yml

if [ -f "$ENVPINNED" ]; then
echo "got pinned"
# Here we build the environment from the pinned definition file,
# this is what we expect users to do.
echo "[mgenv] creating environment $CONDANAME from $ENVPINNED"
conda env create -v --yes --name $CONDANAME --file $ENVPINNED

else
echo "not got pinned"
# Here we rebuild the environment from the unpinned requirements files,
# which is what a maintainer will do when they want to upgrade the pinned
# definition files.
echo "[mgenv] going to try removing $CONDANAME"
conda env remove -v --name="$CONDANAME" || true
fi
conda env remove -v --name=$CONDANAME || true
echo "[mgenv] recreating $ENVPINNED"
echo "[mgenv] installing conda packages"
conda create --yes -v --strict-channel-priority $CHANNEL_OPTS --name $CONDANAME --file ${MGENVDIR}/requirements-conda.txt --file ${MGENVDIR}/requirements-compilers-${OS}.txt
echo "[mgenv] installing packages from pypi"
source activate $CONDANAME
pip install -v -r ${MGENVDIR}/requirements-pypi.txt
echo "[mgenv] exporting environment"
# N.B., here we add the conda-forge/label/broken channel so that the install
# will still work in the future, even if some conda-forge packages have been
# moved to the broken channel.
conda env export -v $CHANNEL_OPTS --channel=conda-forge/label/broken --name=$CONDANAME > $ENVPINNED
echo "*** $ENVPINNED ***"
cat $ENVPINNED
echo "*** $ENVPINNED ***"

fi

0 comments on commit 8ffa098

Please sign in to comment.