conda-forge / miniforge

A conda-forge distribution.
https://conda-forge.org/miniforge
Other
6.16k stars 318 forks source link

`mamba create` and `mamba env create` use different solvers #631

Open gernophil opened 3 weeks ago

gernophil commented 3 weeks ago

Solution to issue cannot be found in the documentation.

Issue

Not sure, of this is a miniforge or mamba issue: If I generate an environment using mamba create -n test python it generates and environment using the mamba solver from the mamba package (this is the desired outcome):

% mamba create -n test python

Looking for: ['python']
...(truncated output)
To activate this environment, use

     $ mamba activate test

To deactivate an active environment, use

     $ mamba deactivate

However, if I create an environment from a yaml file using mamba env create -f test.yaml using this yaml file:

name: test
dependencies:
  - python

it seems like the libmamba solver from the conda package is used:

% mamba env create -f test.yaml 
Channels:
 - conda-forge
 - bioconda
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done
...(truncated output)
# To activate this environment, use
#
#     $ conda activate test
#
# To deactivate an active environment, use
#
#     $ conda deactivate

How can I get mamba env create to use the mamba solver from the mamba package?

Installed packages

# packages in environment at /Users/gernophil/miniforge3:
#
# Name                    Version                   Build  Channel
archspec                  0.2.3              pyhd8ed1ab_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_0    conda-forge
brotli-python             1.1.0           py310h1253130_1    conda-forge
bzip2                     1.0.8                h93a5062_5    conda-forge
c-ares                    1.28.1               h93a5062_0    conda-forge
ca-certificates           2024.2.2             hf0a4a13_0    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py310hdcd7c05_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     24.3.0          py310hbe9552e_0    conda-forge
conda-libmamba-solver     24.1.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.2.0              pyh38be061_0    conda-forge
conda-package-streaming   0.9.0              pyhd8ed1ab_0    conda-forge
distro                    1.9.0              pyhd8ed1ab_0    conda-forge
fmt                       10.2.1               h2ffa867_0    conda-forge
icu                       73.2                 hc8870d7_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
jsonpatch                 1.33               pyhd8ed1ab_0    conda-forge
jsonpointer               2.4             py310hbe9552e_3    conda-forge
krb5                      1.21.2               h92f50d5_0    conda-forge
libarchive                3.7.2                hcacb583_1    conda-forge
libcurl                   8.7.1                h2d989ff_0    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h93a5062_2    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libiconv                  1.17                 h0d3ecfb_2    conda-forge
libmamba                  1.5.8                h90c426b_0    conda-forge
libmambapy                1.5.8           py310h5e0a2f6_0    conda-forge
libnghttp2                1.58.0               ha4dd798_1    conda-forge
libsolv                   0.7.28               h1059232_2    conda-forge
libsqlite                 3.45.2               h091b4b1_0    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libxml2                   2.12.6               h0d0cfa8_1    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
lzo                       2.10              h642e427_1000    conda-forge
mamba                     1.5.8           py310ha5d4528_0    conda-forge
menuinst                  2.0.2           py310hbe9552e_0    conda-forge
ncurses                   6.4.20240210         h078ce10_0    conda-forge
openssl                   3.2.1                h0d3ecfb_1    conda-forge
packaging                 24.0               pyhd8ed1ab_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
pluggy                    1.4.0              pyhd8ed1ab_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.6           py310h2aa6e3c_0    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.14         h2469fbe_0_cpython    conda-forge
python_abi                3.10                    4_cp310    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
reproc                    14.2.4.post0         h93a5062_1    conda-forge
reproc-cpp                14.2.4.post0         h965bd2d_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.18.6          py310hd125d64_0    conda-forge
ruamel.yaml.clib          0.2.8           py310hd125d64_0    conda-forge
setuptools                69.5.1             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tqdm                      4.66.2             pyhd8ed1ab_0    conda-forge
truststore                0.8.0              pyhd8ed1ab_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml-cpp                  0.8.0                h13dd4ca_0    conda-forge
zstandard                 0.22.0          py310h6289e41_0    conda-forge
zstd                      1.5.5                h4f39d0f_0    conda-forge

Environment info

active environment : None
            shell level : 0
       user config file : /Users/gernophil/.condarc
 populated config files : /Users/gernophil/miniforge3/.condarc
                          /Users/gernophil/.condarc
          conda version : 24.3.0
    conda-build version : not installed
         python version : 3.10.14.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m1
                          __conda=24.3.0=0
                          __osx=14.5=0
                          __unix=0=0
       base environment : /Users/gernophil/miniforge3  (writable)
      conda av data dir : /Users/gernophil/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://conda.anaconda.org/bioconda/osx-arm64
                          https://conda.anaconda.org/bioconda/noarch
          package cache : /Users/gernophil/miniforge3/pkgs
                          /Users/gernophil/.conda/pkgs
       envs directories : /Users/gernophil/miniforge3/envs
                          /Users/gernophil/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.3.0 requests/2.31.0 CPython/3.10.14 Darwin/23.5.0 OSX/14.5 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
                UID:GID : 501:20
             netrc file : None
           offline mode : False
jaimergp commented 3 weeks ago

That's a mamba issue. You won't have that issue with the upcoming one v2, but there's nothing we can do from Miniforge for now. That said, both mamba and conda+conda-libmamba-solver should be pretty much equivalent for new environments.

gernophil commented 3 weeks ago

Thanks for the answer. So, do I get you correct that the mamba team is already aware of that and there's no need to file a bug report there?

That said, I still have the impression that mamba is faster then the conda+conda-libmamba-solver. It definitely looks nicer :). I still prefer it.

jaimergp commented 2 weeks ago

I don't know if they'll patch the 1.x releases so the mamba env create endpoint is also monkeypatched. But what I can tell you is that the v2 release doesn't rely on conda at all (think of mamba as a dynamically linked micromamba), as it's C++. So when that's included in this release, you'll just use mamba create --file.

If you'd like to drop your impressions of the performance differences in the conda-libmamba-solver repo, I'd be happy to take a look, but yea, there are a few things we can't avoid in the conda CLI for now.