Skip to content

Commit cb23367

Browse files
lestevethomasjpfan
andauthored
MNT error when conda version is likely to affect conda-lock (scikit-learn#26620)
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
1 parent 4655d8b commit cb23367

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

build_tools/update_environments_and_lock_files.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import logging
3939
from importlib.metadata import version
4040

41+
from packaging.version import Version
42+
4143
import click
4244

4345
from jinja2 import Environment
@@ -539,6 +541,22 @@ def check_conda_lock_version():
539541
)
540542

541543

544+
def check_conda_version():
545+
# Avoid issues with glibc (https://github.com/conda/conda-lock/issues/292)
546+
# or osx (https://github.com/conda/conda-lock/issues/408) virtual package.
547+
# The glibc one has been fixed in conda 23.1.0 and the osx has been fixed
548+
# in main and will be fixed when conda > 23.5.0 is released.
549+
conda_info_output = execute_command(["conda", "info", "--json"])
550+
551+
conda_info = json.loads(conda_info_output)
552+
conda_version = Version(conda_info["conda_version"])
553+
554+
if Version("22.9.0") < conda_version <= Version("23.5.0"):
555+
raise RuntimeError(
556+
f"conda version should be <= 22.9.0 or > 23.5.0, got: {conda_version}"
557+
)
558+
559+
542560
@click.command()
543561
@click.option(
544562
"--select-build",
@@ -547,6 +565,7 @@ def check_conda_lock_version():
547565
)
548566
def main(select_build):
549567
check_conda_lock_version()
568+
check_conda_version()
550569
filtered_conda_build_metadata_list = [
551570
each
552571
for each in conda_build_metadata_list

0 commit comments

Comments
 (0)