File tree Expand file tree Collapse file tree 5 files changed +39
-32
lines changed
Filter options
Expand file tree Collapse file tree 5 files changed +39
-32
lines changed
Original file line number Diff line number Diff line change @@ -59,12 +59,7 @@ check_packages_dev_version() {
59
59
60
60
python_environment_install_and_activate () {
61
61
if [[ " $DISTRIB " == " conda" * ]]; then
62
- # Install/update conda with the libmamba solver because the legacy
63
- # solver can be slow at installing a specific version of conda-lock.
64
- conda install -n base conda conda-libmamba-solver -y
65
- conda config --set solver libmamba
66
- conda install -c conda-forge " $( get_dep conda-lock min) " -y
67
- conda-lock install --name $VIRTUALENV $LOCK_FILE
62
+ create_conda_environment_from_lock_file $VIRTUALENV $LOCK_FILE
68
63
source activate $VIRTUALENV
69
64
70
65
elif [[ " $DISTRIB " == " ubuntu" || " $DISTRIB " == " debian-32" ]]; then
Original file line number Diff line number Diff line change @@ -159,21 +159,20 @@ if [[ `type -t deactivate` ]]; then
159
159
deactivate
160
160
fi
161
161
162
- MAMBAFORGE_PATH=$HOME /mambaforge
163
- # Install dependencies with mamba
164
- wget -q https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh \
165
- -O mambaforge.sh
166
- chmod +x mambaforge.sh && ./mambaforge.sh -b -p $MAMBAFORGE_PATH
167
- export PATH=" /usr/lib/ccache:$MAMBAFORGE_PATH /bin:$PATH "
168
-
162
+ # Install Miniforge
163
+ MINIFORGE_URL=" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh"
164
+ curl -L --retry 10 $MINIFORGE_URL -o miniconda.sh
165
+ MINIFORGE_PATH=$HOME /miniforge3
166
+ bash ./miniconda.sh -b -p $MINIFORGE_PATH
167
+ source $MINIFORGE_PATH /etc/profile.d/conda.sh
168
+ conda activate
169
+
170
+ export PATH=" /usr/lib/ccache:$PATH "
169
171
ccache -M 512M
170
172
export CCACHE_COMPRESS=1
171
173
172
- # pin conda-lock to latest released version (needs manual update from time to time)
173
- mamba install " $( get_dep conda-lock min) " -y
174
-
175
- conda-lock install --log-level DEBUG --name $CONDA_ENV_NAME $LOCK_FILE
176
- source activate $CONDA_ENV_NAME
174
+ create_conda_environment_from_lock_file $CONDA_ENV_NAME $LOCK_FILE
175
+ conda activate $CONDA_ENV_NAME
177
176
178
177
show_installed_libraries
179
178
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ linux_aarch64_test_task:
10
10
CONDA_ENV_NAME : testenv
11
11
LOCK_FILE : build_tools/cirrus/pymin_conda_forge_linux-aarch64_conda.lock
12
12
CONDA_PKGS_DIRS : /root/.conda/pkgs
13
- HOME : / # $HOME is not defined in image and is required to install mambaforge
13
+ HOME : / # $HOME is not defined in image and is required to install Miniforge
14
14
# Upload tokens have been encrypted via the CirrusCI interface:
15
15
# https://cirrus-ci.org/guide/writing-tasks/#encrypted-variables
16
16
# See `maint_tools/update_tracking_issue.py` for details on the permissions the token requires.
Original file line number Diff line number Diff line change @@ -22,19 +22,16 @@ setup_ccache() {
22
22
ccache -M 0
23
23
}
24
24
25
- MAMBAFORGE_URL=" https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-aarch64.sh"
26
-
27
- # Install Mambaforge
28
- curl -L --retry 10 $MAMBAFORGE_URL -o mambaforge.sh
29
- MAMBAFORGE_PATH=$HOME /mambaforge
30
- bash ./mambaforge.sh -b -p $MAMBAFORGE_PATH
31
- export PATH=$MAMBAFORGE_PATH /bin:$PATH
32
- mamba init --all --verbose
33
- mamba update --yes mamba
34
- mamba update --yes conda
35
- mamba install " $( get_dep conda-lock min) " -y
36
- conda-lock install --name $CONDA_ENV_NAME $LOCK_FILE
37
- source activate $CONDA_ENV_NAME
25
+ # Install Miniforge
26
+ MINIFORGE_URL=" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh"
27
+ curl -L --retry 10 $MINIFORGE_URL -o miniconda.sh
28
+ MINIFORGE_PATH=$HOME /miniforge3
29
+ bash ./miniconda.sh -b -p $MINIFORGE_PATH
30
+ source $MINIFORGE_PATH /etc/profile.d/conda.sh
31
+ conda activate
32
+
33
+ create_conda_environment_from_lock_file $CONDA_ENV_NAME $LOCK_FILE
34
+ conda activate $CONDA_ENV_NAME
38
35
39
36
setup_ccache
40
37
Original file line number Diff line number Diff line change @@ -33,3 +33,19 @@ activate_environment() {
33
33
source $VIRTUALENV /bin/activate
34
34
fi
35
35
}
36
+
37
+ create_conda_environment_from_lock_file () {
38
+ ENV_NAME=$1
39
+ LOCK_FILE=$2
40
+ # Because we are using lock-files with the "explicit" format, conda can
41
+ # install them directly, provided the lock-file does not contain pip solved
42
+ # packages. For more details, see
43
+ # https://conda.github.io/conda-lock/output/#explicit-lockfile
44
+ lock_file_has_pip_packages=$( grep -q files.pythonhosted.org $LOCK_FILE && echo " true" || echo " false" )
45
+ if [[ " $lock_file_has_pip_packages " == " false" ]]; then
46
+ conda create --name $ENV_NAME --file $LOCK_FILE
47
+ else
48
+ conda install " $( get_dep conda-lock min) " -y
49
+ conda-lock install --name $ENV_NAME $LOCK_FILE
50
+ fi
51
+ }
You can’t perform that action at this time.
0 commit comments