diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh index 292bd116..ff897c27 100644 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/accpy.sh @@ -24,10 +24,16 @@ if [ "${RESOLVED_REQ}" = true ]; then # Use the same pip configuration as the Acc-Py default pip ACCPY_PIP_CONF="-i $(pip config get global.index-url) --allow-insecure-host $(pip config get global.trusted-host)" uv pip install ${ACCPY_PIP_CONF} -r "${REQ_PATH}" 2>&1 + if [ $? -ne 0 ]; then + return 1 + fi # Enforce installation of our version of ipykernel and its dependencies uv pip install ${ACCPY_PIP_CONF} ${IPYKERNEL} 2>&1 else pip install -r "${REQ_PATH}" 2>&1 + if [ $? -ne 0 ]; then + return 1 + fi # Enforce installation of our version of ipykernel and its dependencies pip install ${IPYKERNEL} 2>&1 fi diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh index ca1d42af..831935a5 100644 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/mamba.sh @@ -3,7 +3,7 @@ # Create the environment, install packages and the same ipykernel that the Jupyter server uses mamba create -p ${ENV_PATH} --file ${REQ_PATH} ${IPYKERNEL} -y if [ $? -ne 0 ]; then - exit 1 + return 1 fi # Activate the environment diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh index df57c6c4..151ad58b 100755 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/builders/venv.sh @@ -17,10 +17,16 @@ eval "${ACTIVATE_ENV_CMD}" _log "Installing packages from ${REQ_PATH}..." if [ "${RESOLVED_REQ}" = true ]; then uv pip install -r "${REQ_PATH}" 2>&1 + if [ $? -ne 0 ]; then + return 1 + fi # Enforce installation of our version of ipykernel and its dependencies uv pip install ${IPYKERNEL} 2>&1 else pip install -r "${REQ_PATH}" 2>&1 + if [ $? -ne 0 ]; then + return 1 + fi # Enforce installation of our version of ipykernel and its dependencies pip install ${IPYKERNEL} 2>&1 fi diff --git a/SwanCustomEnvironments/swancustomenvironments/scripts/makenv.sh b/SwanCustomEnvironments/swancustomenvironments/scripts/makenv.sh index 38484a7f..7679a8c1 100755 --- a/SwanCustomEnvironments/swancustomenvironments/scripts/makenv.sh +++ b/SwanCustomEnvironments/swancustomenvironments/scripts/makenv.sh @@ -181,6 +181,9 @@ _log "Creating environment ${ENV_NAME} using ${BUILDER}${BUILDER_VERSION:+ (${BU # To prevent builders (e.g. mamba) from caching files on EOS, which slows down the creation of the environment, # configure HOME to be the user's local directory HOME=/home/$USER source "${BUILDER_PATH}" +if [ $? -ne 0 ]; then + _log "ERROR: Failed to create the environment." && exit 1 +fi # Install environment kernel. # Setting JUPYTER_PATH prevents ipykernel installation from complaining about non-found kernelspec