From 7ae3bd0cf0e5f3687344c8afc0e7dfe97e919f45 Mon Sep 17 00:00:00 2001 From: lucasfijen Date: Wed, 11 Sep 2024 21:23:34 +0200 Subject: [PATCH] Fix 'conda command not found' in AzureML example Creation scripts (#3321) * Update setup-custom-conda-env.sh * Update install-pip-package.sh * Update setup-custom-conda-env.sh The creation of the conda environment needs to be ran outside of the azureuser block --- setup/setup-ci/install-pip-package.sh | 1 + setup/setup-ci/setup-custom-conda-env.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/setup-ci/install-pip-package.sh b/setup/setup-ci/install-pip-package.sh index d417ad7e2c3..ced2f8ceb34 100644 --- a/setup/setup-ci/install-pip-package.sh +++ b/setup/setup-ci/install-pip-package.sh @@ -8,6 +8,7 @@ sudo -u azureuser -i <<'EOF' PACKAGE=numpy ENVIRONMENT=azureml_py38 +source /anaconda/etc/profile.d/conda.sh conda activate "$ENVIRONMENT" pip install "$PACKAGE" conda deactivate diff --git a/setup/setup-ci/setup-custom-conda-env.sh b/setup/setup-ci/setup-custom-conda-env.sh index e7a0059e33c..204d0799c73 100644 --- a/setup/setup-ci/setup-custom-conda-env.sh +++ b/setup/setup-ci/setup-custom-conda-env.sh @@ -4,12 +4,14 @@ set -e # This script creates a custom conda environment and kernel based on a sample yml file. +source /anaconda/etc/profile.d/conda.sh conda env create -f env.yml echo "Activating new conda environment" conda activate envname conda install -y ipykernel -echo "Installing kernel" sudo -u azureuser -i <<'EOF' +echo "Installing kernel" +source /anaconda/etc/profile.d/conda.sh conda activate envname python -m ipykernel install --user --name envname --display-name "mykernel" echo "Conda environment setup successfully."