mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.93k stars 358 forks source link

micromamba 1.5.10 fails to create environments in parallel when cache has been cleaned with -f before #3602

Open b-morgenthaler opened 2 days ago

b-morgenthaler commented 2 days ago

Troubleshooting docs

Anaconda default channels

How did you install Mamba?

Micromamba

Search tried in issue tracker

parallel

Latest version of Mamba

Tried in Conda?

I didn't try

Describe your issue

Hi,

We are using micromamba 1.5.10 in our Gitlab CI pipeline. The Gitlab runner is an Ubuntu 22.04 LTS VM (shell executor). The pipeline has several stages: one of the first ones is taking care of creating the environments - one environment per job. At the end, the .post stage is taking care of cleaning the micromamba cache (the created environments are removed already). There is no configuration file existing - so all defaults unless given by the command line options.

Findings

Side note regarding Latest version of Mamba: our SCM strategy forbids me to upgrade to micromamba 2.x currently, so I actually don't know if this issue also exists with 2.x.

Here's a minimal gist of the pipeline for better understanding the use case:

variables:
  MICROMAMBA_PATH: ${CI_PROJECT_DIR}/micromamba/linux/bin
  MICROMAMBA: ${MICROMAMBA_PATH}/micromamba
  MAMBA_ROOT_PREFIX: /home/gitlab-runner/micromamba

stages:
  - qa

env_1
  variables:
  stage: qa
  before_script:
    - ${MICROMAMBA} create --no-rc -y -c conda-forge --no-pyc --strict-channel-priority --allow-uninstall -f ${CONDA_LOCK_FILE} -n ${CONDA_NAME_1}
  script:
    - echo "do some things inside the environment"
  after_script:
    - ${MICROMAMBA} -n ${CONDA_NAME_1} --no-rc -y env remove || true

env_2
  variables:
  stage: qa
  before_script:
    - ${MICROMAMBA} create --no-rc -y -c conda-forge --no-pyc --strict-channel-priority --allow-uninstall -f ${CONDA_LOCK_FILE} -n ${CONDA_NAME_2}
  script:
    - echo "do some things inside the environment"
  after_script:
    - ${MICROMAMBA} -n ${CONDA_NAME_2} --no-rc -y env remove || true

env_3
  variables:
  stage: qa
  before_script:
    - ${MICROMAMBA} create --no-rc -y -c conda-forge --no-pyc --strict-channel-priority --allow-uninstall -f ${CONDA_LOCK_FILE} -n ${CONDA_NAME_3}
  script:
    - echo "do some things inside the environment"
  after_script:
    - ${MICROMAMBA} -n ${CONDA_NAME_3} --no-rc -y env remove || true

clean_environment:
  stage: .post
  script:
    - ${MICROMAMBA} clean --all -r -y || true
  when: always

mamba info / micromamba info

libmamba version : 1.5.10
     micromamba version : 1.5.10
           curl version : libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 zstd/1.5.6 libssh2/1.11.0 nghttp2/1.58.0
     libarchive version : libarchive 3.7.4 zlib/1.2.13 bz2lib/1.0.8 libzstd/1.5.6
       envs directories : /home/gitlab-runner/micromamba/envs
          package cache : /home/gitlab-runner/micromamba/pkgs
                          /home/gitlab-runner/.mamba/pkgs
            environment : None (not found)
           env location : -
      user config files : /home/gitlab-runner/.mambarc
 populated config files :
       virtual packages : __unix=0=0
                          __linux=5.4.0=0
                          __glibc=2.31=0
                          __archspec=1=x86_64_v4
               channels :
       base environment : /home/gitlab-runner/micromamba
               platform : linux-64

Logs

Executing "step_script" stage of the job script
$ ${MICROMAMBA} create --no-rc -y -c conda-forge --no-pyc --strict-channel-priority --allow-uninstall -f ${CONDA_LOCK_FILE} -n ${CONDA_NAME_1}
Empty environment created at prefix: /home/gitlab-runner/micromamba/envs/unique_name_1
Transaction
  Prefix: /home/gitlab-runner/micromamba/envs/unique_name_1
  No specs added or removed.
  Package                                             Version  Build               Channel                                                             Size
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  Install:
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  [a lot of packages to be installed]
  Summary:
  Install: 232 packages
  Total download: 0 B
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Transaction starting
error    libmamba Error opening for reading "/home/gitlab-runner/micromamba/pkgs/[package].conda": No such file or directory
[package].conda tarball has incorrect checksum
error    libmamba File not valid: SHA256 sum doesn't match expectation "/home/gitlab-runner/micromamba/pkgs/[package].conda"
    Expected: 68d3bbfe418dda8805b7af1e933b45a2ec4064dae53a281201418cad79578b45
    Actual: e3b0c44298fc1c149afbf4c8996fb924ae41e4649b934ca495991b7852b855

warning  libmamba '/home/gitlab-runner/micromamba/pkgs/[package].conda' validation failed
critical libmamba Found incorrect download: [package name] Aborting

environment.yml

# please note that we use conda lock files to create environments
# this is an example, the environment file (resp. the conda lock file from it)
# doesn't actually matter or change the error
name: python_build_process
channels:
- [URL to our internal conda-forge proxy from Sonatype Nexus Repository OSS 3.68.1-02]
dependencies:
- python=3.12.*
- pdm==2.19.3
# - add any conda-forge listed package here

~/.condarc

no .condarc/.mambarc in the Gitlab runner user's home
jjerphan commented 2 days ago

Thank you for this report.

Can you also reproduce the problem with micromamba 2.0?