From 7172e40c04ca0ec90e71a717288e9efbf399b7a8 Mon Sep 17 00:00:00 2001 From: Vincent Moens Date: Fri, 20 Dec 2024 12:22:30 +0000 Subject: [PATCH 1/2] [CI] Fix conda on windows --- .../windows_optdepts/scripts/install.sh | 3 +-- .../windows_optdepts/scripts/run_test.sh | 3 +-- .../windows_optdepts/scripts/setup_env.sh | 18 ++---------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/unittest/windows_optdepts/scripts/install.sh b/.github/unittest/windows_optdepts/scripts/install.sh index f13b83a0be0..f6b69e3121a 100644 --- a/.github/unittest/windows_optdepts/scripts/install.sh +++ b/.github/unittest/windows_optdepts/scripts/install.sh @@ -9,8 +9,7 @@ set -ex this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" -conda activate ./env +conda activate torchrl # TODO, refactor the below logic to make it easy to understand how to get correct cuda_version. if [ "${CU_VERSION:-}" == cpu ] ; then diff --git a/.github/unittest/windows_optdepts/scripts/run_test.sh b/.github/unittest/windows_optdepts/scripts/run_test.sh index 351eb4bfef7..739d0b25e30 100644 --- a/.github/unittest/windows_optdepts/scripts/run_test.sh +++ b/.github/unittest/windows_optdepts/scripts/run_test.sh @@ -2,8 +2,7 @@ set -e -eval "$(./conda/Scripts/conda.exe 'shell.bash' 'hook')" -conda activate ./env +conda activate torchrl this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source "$this_dir/set_cuda_envs.sh" diff --git a/.github/unittest/windows_optdepts/scripts/setup_env.sh b/.github/unittest/windows_optdepts/scripts/setup_env.sh index 84f709d6537..06955631166 100644 --- a/.github/unittest/windows_optdepts/scripts/setup_env.sh +++ b/.github/unittest/windows_optdepts/scripts/setup_env.sh @@ -9,31 +9,17 @@ set -e this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" root_dir="$(git rev-parse --show-toplevel)" -conda_dir="${root_dir}/conda" env_dir="${root_dir}/env" cd "${root_dir}" -# 1. Install conda at ./conda -if [ ! -d "${conda_dir}" ]; then - printf "* Installing conda\n" - export tmp_conda="$(echo $conda_dir | tr '/' '\\')" - export miniconda_exe="$(echo $root_dir | tr '/' '\\')\\miniconda.exe" - curl --output miniconda.exe https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -O - "$this_dir/install_conda.bat" - unset tmp_conda - unset miniconda_exe -fi - -eval "$(${conda_dir}/Scripts/conda.exe 'shell.bash' 'hook')" - # 2. Create test environment at ./env printf "* Creating a test environment\n" -conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION" +conda create --prefix torchrl -y python="$PYTHON_VERSION" printf "* Activating the environment" conda deactivate -conda activate "${env_dir}" +conda activate torchrl printf "Python version" echo $(which python) From 2294f37f35b2c9d0b66b3b3d0b45bb703b8409d3 Mon Sep 17 00:00:00 2001 From: Vincent Moens Date: Fri, 20 Dec 2024 13:31:28 +0000 Subject: [PATCH 2/2] add conda init --- .github/unittest/windows_optdepts/scripts/setup_env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/unittest/windows_optdepts/scripts/setup_env.sh b/.github/unittest/windows_optdepts/scripts/setup_env.sh index 06955631166..09d6f1f0253 100644 --- a/.github/unittest/windows_optdepts/scripts/setup_env.sh +++ b/.github/unittest/windows_optdepts/scripts/setup_env.sh @@ -15,10 +15,10 @@ cd "${root_dir}" # 2. Create test environment at ./env printf "* Creating a test environment\n" -conda create --prefix torchrl -y python="$PYTHON_VERSION" +conda init bash +conda create -n torchrl -y python="$PYTHON_VERSION" printf "* Activating the environment" -conda deactivate conda activate torchrl printf "Python version"