Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d04bdae

Browse filesBrowse files
lestevejeremiedbb
authored andcommitted
CI Create environment with conda rather than conda-lock when possible (scikit-learn#29176)
1 parent d39f065 commit d04bdae
Copy full SHA for d04bdae

File tree

Expand file treeCollapse file tree

5 files changed

+39
-32
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+39
-32
lines changed

‎build_tools/azure/install.sh

Copy file name to clipboardExpand all lines: build_tools/azure/install.sh
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@ check_packages_dev_version() {
5959

6060
python_environment_install_and_activate() {
6161
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
6863
source activate $VIRTUALENV
6964

7065
elif [[ "$DISTRIB" == "ubuntu" || "$DISTRIB" == "debian-32" ]]; then

‎build_tools/circle/build_doc.sh

Copy file name to clipboardExpand all lines: build_tools/circle/build_doc.sh
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,21 +159,20 @@ if [[ `type -t deactivate` ]]; then
159159
deactivate
160160
fi
161161

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"
169171
ccache -M 512M
170172
export CCACHE_COMPRESS=1
171173

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
177176

178177
show_installed_libraries
179178

‎build_tools/cirrus/arm_tests.yml

Copy file name to clipboardExpand all lines: build_tools/cirrus/arm_tests.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ linux_aarch64_test_task:
1010
CONDA_ENV_NAME: testenv
1111
LOCK_FILE: build_tools/cirrus/pymin_conda_forge_linux-aarch64_conda.lock
1212
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
1414
# Upload tokens have been encrypted via the CirrusCI interface:
1515
# https://cirrus-ci.org/guide/writing-tasks/#encrypted-variables
1616
# See `maint_tools/update_tracking_issue.py` for details on the permissions the token requires.

‎build_tools/cirrus/build_test_arm.sh

Copy file name to clipboardExpand all lines: build_tools/cirrus/build_test_arm.sh
+10-13Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,16 @@ setup_ccache() {
2222
ccache -M 0
2323
}
2424

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
3835

3936
setup_ccache
4037

‎build_tools/shared.sh

Copy file name to clipboardExpand all lines: build_tools/shared.sh
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ activate_environment() {
3333
source $VIRTUALENV/bin/activate
3434
fi
3535
}
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+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.