mamba-org / mamba

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

mamba 1.5.7 fails when updating environment created with conda-lock #3212

Closed zaneselvans closed 5 months ago

zaneselvans commented 5 months ago

Troubleshooting docs

Anaconda default channels

How did you install Mamba?

Mambaforge or latest Miniforge

Search tried in issue tracker

I searched for md5 and MatchSpec

Latest version of Mamba

Tried in Conda?

I have this problem with Conda as well, without using Mamba

Describe your issue

I'm attempting to install additional packages into an environment based on a conda-lock file using this command:

mamba env update -f environments/user-environment.yml

Which results in this error:

InvalidMatchSpec: Invalid spec 'conda-forge/noarch::addfips==0.4.0=pyhd8ed1ab_1[md5=cb434d01bfd3ba57c54a423f3773ffda]': Libmamba only supports a subset of the MatchSpec interface for now. You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('md5',).

I get the same error when I try to use conda to do the same thing:

mamba env update -f environments/user-environment.yml

The contents of environments/user-environment.yml are:

---
channels:
  - conda-forge
  - defaults
dependencies:
  - jupyterlab_vim>=4
  - kaggle>=1.5
  - python-duckdb>=0.10
  - sqlite-utils>=3.26

The same commands work fine when I downgrate to mamba v1.5.6 and conda v23.x, so it seems like some kind of regression.

addfips is just the first normal package to appear in the lockfile. I don't think there's anything special about it. Below is the beginning of conda-lock.yml including addfips specs. The full lockfile was too large to include in a comment.

# This lock file was generated by conda-lock (https://github.com/conda/conda-lock). DO NOT EDIT!
#
# A "lock file" contains a concrete list of package versions (with checksums) to be installed. Unlike
# e.g. `conda env create`, the resulting environment will not change as new package versions become
# available, unless you explicitly update the lock file.
#
# Install this environment as "YOURENV" with:
#     conda-lock install -n YOURENV --file conda-lock.yml
# This lock contains optional development dependencies. Include them in the installed environment with:
#     conda-lock install --dev-dependencies -n YOURENV --file conda-lock.yml
# To update a single package to the latest version compatible with the version constraints in the source:
#     conda-lock lock  --lockfile conda-lock.yml --update PACKAGE
# To re-solve the entire environment, e.g. after changing a version constraint in the source file:
#     conda-lock -f ../pyproject.toml --lockfile conda-lock.yml
version: 1
metadata:
  content_hash:
    linux-64: ab2f694fe657043031561f313cbdfcaaf23bbeb20c0a75fd6f789e50ca8b8a5f
    osx-64: a8e990496badda125bcde04c925382e2cec127d00c270926ef8d6fe42d744fe1
    osx-arm64: 3a6ac561f59411eae265dfb4684cd48bb7b70a2eb5ec7b60cd0c2b0671c34c78
  channels:
    - url: conda-forge
      used_env_vars: []
    - url: defaults
      used_env_vars: []
  platforms:
    - linux-64
    - osx-64
    - osx-arm64
  sources:
    - ../pyproject.toml
package:
  - name: _libgcc_mutex
    version: "0.1"
    manager: conda
    platform: linux-64
    dependencies: {}
    url: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
    hash:
      md5: d7c89558ba9fa0495403155b64376d81
      sha256: fe51de6107f9edc7aa4f786a70f4a883943bc9d39b3bb7307c04c41410990726
    category: main
    optional: false
  - name: _openmp_mutex
    version: "4.5"
    manager: conda
    platform: linux-64
    dependencies:
      _libgcc_mutex: "0.1"
      libgomp: ">=7.5.0"
    url: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2
    hash:
      md5: 73aaf86a425cc6e73fcf236a5a46396d
      sha256: fbe2c5e56a653bebb982eda4876a9178aedfc2b545f25d0ce9c4c0b508253d22
    category: main
    optional: false
  - name: addfips
    version: 0.4.0
    manager: conda
    platform: linux-64
    dependencies:
      importlib_resources: ">=5.0"
      python: ">=3.7.5"
    url: https://conda.anaconda.org/conda-forge/noarch/addfips-0.4.0-pyhd8ed1ab_1.conda
    hash:
      md5: cb434d01bfd3ba57c54a423f3773ffda
      sha256: c6f7bf91f19ad4fdd183efde6346a0dfd3df7929f413c9535e19c51610b4f671
    category: main
    optional: false
  - name: addfips
    version: 0.4.0
    manager: conda
    platform: osx-64
    dependencies:
      importlib_resources: ">=5.0"
      python: ">=3.7.5"
    url: https://conda.anaconda.org/conda-forge/noarch/addfips-0.4.0-pyhd8ed1ab_1.conda
    hash:
      md5: cb434d01bfd3ba57c54a423f3773ffda
      sha256: c6f7bf91f19ad4fdd183efde6346a0dfd3df7929f413c9535e19c51610b4f671
    category: main
    optional: false
  - name: addfips
    version: 0.4.0
    manager: conda
    platform: osx-arm64
    dependencies:
      importlib_resources: ">=5.0"
      python: ">=3.7.5"
    url: https://conda.anaconda.org/conda-forge/noarch/addfips-0.4.0-pyhd8ed1ab_1.conda
    hash:
      md5: cb434d01bfd3ba57c54a423f3773ffda
      sha256: c6f7bf91f19ad4fdd183efde6346a0dfd3df7929f413c9535e19c51610b4f671
    category: main
    optional: false

mamba info / micromamba info

mamba version : 1.5.7
     active environment : pudl-dev
    active env location : /Users/zane/miniforge3/envs/pudl-dev
            shell level : 1
       user config file : /Users/zane/.condarc
 populated config files : /Users/zane/miniforge3/.condarc
                          /Users/zane/.condarc
          conda version : 24.1.2
    conda-build version : not installed
         python version : 3.10.13.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m1
                          __conda=24.1.2=0
                          __osx=14.3.1=0
                          __unix=0=0
       base environment : /Users/zane/miniforge3  (writable)
      conda av data dir : /Users/zane/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/zane/miniforge3/pkgs
                          /Users/zane/.conda/pkgs
       envs directories : /Users/zane/miniforge3/envs
                          /Users/zane/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.1.2 requests/2.31.0 CPython/3.10.13 Darwin/23.3.0 OSX/14.3.1 solver/libmamba conda-libmamba-solver/23.12.0 libmambapy/1.5.7
                UID:GID : 1000:20
             netrc file : None
           offline mode : False

Logs

Channels:
 - conda-forge
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): ...working... info     libmamba Reading cache files '/var/folders/ps/6jyqvztj5fq_tvhwx5h59d7w0000z8/T/tmp601vxti4.json.*' for repo index 'installed'
info     libmamba Reading repodata.json file "/var/folders/ps/6jyqvztj5fq_tvhwx5h59d7w0000z8/T/tmp601vxti4.json" for repo installed
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/a850f475.json.*' for repo index 'https://conda.anaconda.org/conda-forge/osx-arm64'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/a850f475.json" for repo https://conda.anaconda.org/conda-forge/osx-arm64
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/a850f475.solv" for repo https://conda.anaconda.org/conda-forge/osx-arm64
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/09cdf8bf.json.*' for repo index 'https://conda.anaconda.org/conda-forge/noarch'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/09cdf8bf.json" for repo https://conda.anaconda.org/conda-forge/noarch
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/09cdf8bf.solv" for repo https://conda.anaconda.org/conda-forge/noarch
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/9e99ffaf.json.*' for repo index 'https://repo.anaconda.com/pkgs/main/osx-arm64'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/9e99ffaf.json" for repo https://repo.anaconda.com/pkgs/main/osx-arm64
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/9e99ffaf.solv" for repo https://repo.anaconda.com/pkgs/main/osx-arm64
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/3e39a7aa.json.*' for repo index 'https://repo.anaconda.com/pkgs/main/noarch'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/3e39a7aa.json" for repo https://repo.anaconda.com/pkgs/main/noarch
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/3e39a7aa.solv" for repo https://repo.anaconda.com/pkgs/main/noarch
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/8bd55712.json.*' for repo index 'https://repo.anaconda.com/pkgs/r/osx-arm64'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/8bd55712.json" for repo https://repo.anaconda.com/pkgs/r/osx-arm64
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/8bd55712.solv" for repo https://repo.anaconda.com/pkgs/r/osx-arm64
info     libmamba Reading cache files '/Users/zane/miniforge3/pkgs/cache/4ea078d6.json.*' for repo index 'https://repo.anaconda.com/pkgs/r/noarch'
info     libmamba Reading repodata.json file "/Users/zane/miniforge3/pkgs/cache/4ea078d6.json" for repo https://repo.anaconda.com/pkgs/r/noarch
info     libmamba Writing libsolv solv file "/Users/zane/miniforge3/pkgs/cache/4ea078d6.solv" for repo https://repo.anaconda.com/pkgs/r/noarch
done
Solving environment: ...working... failed

InvalidMatchSpec: Invalid spec 'conda-forge/noarch::addfips==0.4.0=pyhd8ed1ab_1[md5=cb434d01bfd3ba57c54a423f3773ffda]': Libmamba only supports a subset of the MatchSpec interface for now. You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('md5',).

environment.yml

No response

~/.condarc

channel_priority: strict
channels:
  - conda-forge
  - defaults
auto_activate_base: false
default_python: '3.10'
Hind-M commented 5 months ago

Please remove the Anaconda defaults channels from the ~/.condarc and all the environment.yml files as the behavior is not guaranteed and therefore this is not recommended (cf. https://mamba.readthedocs.io/en/latest/user_guide/troubleshooting.html#using-the-defaults-channels). Can you try again after removing them and report if the bug is still there? Thanks!

zaneselvans commented 5 months ago

Thanks for the suggestion. I've removed the defaults channel from both my .condarc and the user-environment.yml file, and I am still getting the Invalid MatchSpec error:

$ mamba env update --file environments/user-environment.yml
Channels:
 - conda-forge
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: failed

InvalidMatchSpec: Invalid spec 'conda-forge/noarch::addfips==0.4.0=pyhd8ed1ab_1[md5=cb434d01bfd3ba57c54a423f3773ffda]':
Libmamba only supports a subset of the MatchSpec interface for now.
You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('md5',).

Updated file contents:

~/.condarc

channel_priority: strict
channels:
  - conda-forge
auto_activate_base: false
default_python: '3.11'

environments/user-environment.yml

---
channels:
  - conda-forge
dependencies:
  - jupyterlab_vim>=4.1
  - kaggle>=1.6
  - sqlite-utils>=3.36
  - jupyter-lsp
  - jupyterlab-lsp
  - ruff-lsp>=0.0.53

mamba info


          mamba version : 1.5.7
     active environment : pudl-dev
    active env location : /Users/zane/miniforge3/envs/pudl-dev
            shell level : 1
       user config file : /Users/zane/.condarc
 populated config files : /Users/zane/miniforge3/.condarc
                          /Users/zane/.condarc
          conda version : 24.1.2
    conda-build version : not installed
         python version : 3.10.13.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m1
                          __conda=24.1.2=0
                          __osx=14.4=0
                          __unix=0=0
       base environment : /Users/zane/miniforge3  (writable)
      conda av data dir : /Users/zane/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/zane/miniforge3/pkgs
                          /Users/zane/.conda/pkgs
       envs directories : /Users/zane/miniforge3/envs
                          /Users/zane/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.1.2 requests/2.31.0 CPython/3.10.13 Darwin/23.4.0 OSX/14.4 solver/libmamba conda-libmamba-solver/23.12.0 libmambapy/1.5.7
                UID:GID : 1000:20
             netrc file : None
           offline mode : False
jaimergp commented 5 months ago

InvalidMatchSpec: Invalid spec 'conda-forge/noarch::addfips==0.4.0=pyhd8ed1ab_1[md5=cb434d01bfd3ba57c54a423f3773ffda]': Libmamba only supports a subset of the MatchSpec interface for now. You can only use ('name', 'version', 'build', 'channel', 'subdir'), but you tried to use ('md5',).

That kind of message comes from conda-libmamba-solver; we fixed in 24.1.0 but you have 23.12.0. Try updating it first?

zaneselvans commented 5 months ago

Oh weird, I wonder why that library wasn't getting updated automatically. Will update!

Edit: This seems to have fixed the issue described above. Still not sure why the conda-libmamba-solver library wasn't getting updated, but I did it manually and all is well now.