From a5b09a0cdc22c236363e3cf9993d255877e56563 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 12 Sep 2023 07:51:50 +0100 Subject: [PATCH 1/2] revert to conda but with libmamaba solver --- CHANGES.md | 3 ++- docker/install-sirf-exercises-dep.py | 12 ++++++------ docker/user_demos.sh | 4 ++-- docker/user_python-ubuntu.sh | 24 +++++++++++------------- 4 files changed, 21 insertions(+), 22 deletions(-) mode change 100755 => 100644 docker/user_demos.sh diff --git a/CHANGES.md b/CHANGES.md index c26da837..9bcc5469 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ - The `devel` tag (for `DEVEL_BUILD=ON` with `master` versions of SIRF, STIR etc) is no longer pushed to DockerHub, and therefore will not be updated. - Docker images are now pushed to [DockerHub](https://hub.docker.com/r/synerbi/sirf/tags) and [GHCR](https://github.com/SyneRBI/SIRF-SuperBuild/pkgs/container/sirf) - added requirements.yml + - revert to `conda` but with `libmamba` solver - updated versions: - SIRF: v3.6.0 - STIR: v6.0.0 @@ -41,7 +42,7 @@ - docker image updates - introduce `REMOVE_BUILD_FILES` variable. If set to 1 (which is the default), most build files will be removed in the docker image. - - introduce `RUN_CTESTS` variable. If set to 1 (which is the default), + - introduce `RUN_CTEST` variable. If set to 1 (which is the default), the CTests will be run while building the image. - remove obsolete copying of gadgetron.xml - Installing requirements for SIRF-Exercises uses its environment.yml or requirements.txt depending on settings. diff --git a/docker/install-sirf-exercises-dep.py b/docker/install-sirf-exercises-dep.py index 89763495..e78767a8 100644 --- a/docker/install-sirf-exercises-dep.py +++ b/docker/install-sirf-exercises-dep.py @@ -4,7 +4,7 @@ import functools def conda_install(package): - return f'mamba install -y -c conda-forge {package}'.rstrip() + return f'conda install -y -c conda-forge {package}'.rstrip() def pip_install(package): return f'pip install -U {package}'.rstrip() @@ -30,18 +30,18 @@ def pip_install(package): else: print (f'Not on conda-forge: {line.rstrip()}') install_by_pip.append(line.rstrip()) - + install_by_conda = functools.reduce(lambda x, y: x + ' ' + y, install_by_conda, '') - + install_by_pip = functools.reduce(lambda x, y: x + ' ' + y, install_by_pip, '') - + try: print ("Installing from conda-forge:", install_by_conda) subprocess.run(conda_install(install_by_conda), shell=True, check=True) print ("Installing from PyPI:", install_by_pip) subprocess.run([sys.executable, "-m", pip_install(install_by_pip)], shell=True, check=True) - + except subprocess.CalledProcessError as cpe: - print (cpe) \ No newline at end of file + print (cpe) diff --git a/docker/user_demos.sh b/docker/user_demos.sh old mode 100755 new mode 100644 index 00e822ea..3527b887 --- a/docker/user_demos.sh +++ b/docker/user_demos.sh @@ -22,11 +22,11 @@ if [ "$PYTHON" = "miniconda" ]; then # delete GPU deps sed -r -e '/^\s*- (astra-toolbox|tigre).*/d' -e '/^\s*- \S+.*#.*GPU/d' environment.yml > environment-sirf.yml fi - mamba env update --file environment-sirf.yml + conda env update --file environment-sirf.yml else if [ -f requirements.txt ]; then cat requirements.txt - # installing the requirements.txt with mamba requires some cleaning of the requirements.txt + # installing the requirements.txt with conda requires some cleaning of the requirements.txt # Also the requirements.txt contains some packages that are not found on conda-forge, i.e. brainweb # Therefore, these need to be installed by pip. # This is handled by the install-sirf-exercises-dep.py script diff --git a/docker/user_python-ubuntu.sh b/docker/user_python-ubuntu.sh index 248c5613..565f2c96 100755 --- a/docker/user_python-ubuntu.sh +++ b/docker/user_python-ubuntu.sh @@ -1,17 +1,17 @@ #!/usr/bin/env bash -# User can pass 2 parameters to this script: +# User can pass 2 parameters to this script: # 1. PYTHON_EXECUTABLE which can be either the 'miniconda' string or the location of the Python executable # 2. PYTHON_INSTALL_DIR which points to the location where the user has their virtual environment installed # The virtual environment can be either virtualenv or conda # # To pass these parameters the user needs to set (at least) temporary environment variables: # PYTHON_EXECUTABLE=python3 PYTHON_INSTALL_DIR="~/virtualenv" bash user_python-ubuntu.sh -# For details see https://github.com/SyneRBI/SIRF-SuperBuild/pull/692#issuecomment-1102704682 +# For details see https://github.com/SyneRBI/SIRF-SuperBuild/pull/692#issuecomment-1102704682 [ -f .bashrc ] && . .bashrc set -exv -if [ -n "${PYTHON_EXECUTABLE}" ]; then +if [ -n "${PYTHON_EXECUTABLE}" ]; then PYTHON=$PYTHON_EXECUTABLE else PYTHON='miniconda' @@ -26,16 +26,14 @@ fi # Python case "$PYTHON" in miniconda) - #curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > miniconda.sh - curl -L https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh > miniconda.sh + curl -L https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > miniconda.sh echo -e "\nyes\n${INSTALL_DIR}\nno" | bash miniconda.sh rm miniconda.sh source "$INSTALL_DIR"/bin/activate - #conda config --add channels conda-forge - # https://github.com/conda/conda/issues/6030 - #conda update -c conda-forge -y conda - # https://github.com/SyneRBI/SIRF-SuperBuild/issues/826 - #conda install -c conda-forge -c defaults -y mamba + conda config --add channels conda-forge + conda update -c conda-forge -y conda + conda install conda-libmamba-solver + conda config --set solver libmamba ;; *python*) # virtualenv @@ -54,11 +52,11 @@ esac if [ "$PYTHON" = "miniconda" ]; then if [ -f requirements.yml ]; then - # installs the required packages in the environment with requirements.yml. + # installs the required packages in the environment with requirements.yml. # Notice that SciPy is set to 1.7.3 to prevent `GLIBCXX_3.4.30' not found - mamba env update --file requirements.yml + conda env update --file requirements.yml fi - mamba clean -y --all + conda clean -y --all # Python (runtime) else if [ -f requirements.txt ]; then From 44a35f513e2b71d826354fc086da5f1b0ed51890 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 12 Sep 2023 16:52:55 +0100 Subject: [PATCH 2/2] drop explicit libmamba solver --- docker/user_demos.sh | 0 docker/user_python-ubuntu.sh | 2 -- 2 files changed, 2 deletions(-) mode change 100644 => 100755 docker/user_demos.sh diff --git a/docker/user_demos.sh b/docker/user_demos.sh old mode 100644 new mode 100755 diff --git a/docker/user_python-ubuntu.sh b/docker/user_python-ubuntu.sh index 565f2c96..e1d61a28 100755 --- a/docker/user_python-ubuntu.sh +++ b/docker/user_python-ubuntu.sh @@ -32,8 +32,6 @@ miniconda) source "$INSTALL_DIR"/bin/activate conda config --add channels conda-forge conda update -c conda-forge -y conda - conda install conda-libmamba-solver - conda config --set solver libmamba ;; *python*) # virtualenv