From 6dccbbe68b8accd0216c343c6077cdfbc076aa14 Mon Sep 17 00:00:00 2001 From: Min RK Date: Thu, 1 Feb 2018 13:35:12 +0100 Subject: [PATCH] update conda used for freezing and remove workaround for conda-export bug Bug is fixed in conda 4.4 --- repo2docker/buildpacks/conda/freeze.py | 32 +++----------------------- 1 file changed, 3 insertions(+), 29 deletions(-) mode change 100644 => 100755 repo2docker/buildpacks/conda/freeze.py diff --git a/repo2docker/buildpacks/conda/freeze.py b/repo2docker/buildpacks/conda/freeze.py old mode 100644 new mode 100755 index ab7cebbc..142014bd --- a/repo2docker/buildpacks/conda/freeze.py +++ b/repo2docker/buildpacks/conda/freeze.py @@ -15,6 +15,8 @@ from ruamel.yaml import YAML MINICONDA_VERSION = '4.3.27' +# need conda ≥ 4.4 to avoid bug adding spurious pip dependencies +CONDA_VERSION = '4.4.8' HERE = pathlib.Path(os.path.dirname(os.path.abspath(__file__))) @@ -27,34 +29,6 @@ FROZEN_FILE_T = os.path.splitext(ENV_FILE_T)[0] + '.frozen.yml' yaml = YAML(typ='rt') -def fixup(frozen_file): - """Fixup a frozen environment file - - Conda export has a bug! - https://github.com/conda/conda/pull/6391 - """ - with open(frozen_file) as f: - env = yaml.load(f) - - # scrub spurious pip dependencies - # due to conda #6391 - - # note: this scrubs *all* pip dependencies, - # so be more careful if we ever *want* conda to call - # out to pip. - pip_found = False - for idx, dep in enumerate(env['dependencies']): - if isinstance(dep, dict) and 'pip' in dep: - pip_found = True - break - - if pip_found: - env['dependencies'].pop(idx) - - with open(frozen_file, 'w') as f: - yaml.dump(env, f) - - def freeze(env_file, frozen_file): """Freeze a conda environment.yml @@ -79,6 +53,7 @@ def freeze(env_file, frozen_file): f"continuumio/miniconda3:{MINICONDA_VERSION}", "sh", "-c", '; '.join([ + f"conda install -yq conda={CONDA_VERSION}", 'conda config --add channels conda-forge', 'conda config --system --set auto_update_conda false', f"conda env create -v -f /r2d/{env_file} -n r2d", @@ -88,7 +63,6 @@ def freeze(env_file, frozen_file): f"conda env export -n r2d >> /r2d/{frozen_file}", ]) ]) - fixup(HERE / frozen_file) def set_python(py_env_file, py):