conda / conda-libmamba-solver

The libmamba based solver for conda.
https://conda.github.io/conda-libmamba-solver/
Other
204 stars 25 forks source link

`conda update` behaves differently with `libmamba` solver #71

Closed jaimergp closed 1 year ago

jaimergp commented 2 years ago

Checklist

What happened?

Using the gvleobas environment on win-64, conda update python reports "already satisfied" right away with classic. However, with libmamba, it tries to solve anyway and comes up with a downgrade: from Python 3.9.10 to Python 3.9.9.

This is the kind of subtle behaviour we try to work around with the "last resort" exceptions. libmamba often recognizes an environment as already satisfied, while classic does not, so we added those clauses to force the change. However, in this case, it's the opposite!

We need to find a balance and appropriate counter-cases.

Conda info

conda info

     active environment : leo
    active env location : D:\Users\jrodriguez\Miniconda3\envs\leo
            shell level : 2
       user config file : D:\Users\jrodriguez\.condarc
 populated config files :
          conda version : 4.11.0.73_gb1ea4be80
    conda-build version : not installed
         python version : 3.9.5.final.0
       virtual packages : __win=0=0
                          __archspec=1=x86_64
       base environment : D:\Users\jrodriguez\Miniconda3  (writable)
      conda av data dir : D:\Users\jrodriguez\Miniconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : D:\Users\jrodriguez\Miniconda3\pkgs
                          D:\Users\jrodriguez\.conda\pkgs
                          D:\Users\jrodriguez\AppData\Local\conda\conda\pkgs
       envs directories : D:\Users\jrodriguez\Miniconda3\envs
                          D:\Users\jrodriguez\.conda\envs
                          D:\Users\jrodriguez\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.11.0.73_gb1ea4be80 requests/2.25.1 CPython/3.9.5 Windows/10 Windows/10.0.14393
          administrator : False
             netrc file : None
           offline mode : False

Conda config

(default)

Conda list

# packages in environment at D:\Users\jrodriguez\Miniconda3\envs\leo:
#
# Name                    Version                   Build  Channel
_go_select                2.3.0                       cgo    conda-forge
abseil-cpp                20210324.2           h0e60522_0    conda-forge
arrow-cpp                 6.0.1           py39h591eb41_8_cpu    conda-forge
aws-c-cal                 0.5.11               he19cf47_0    conda-forge
aws-c-common              0.6.2                h8ffe710_0    conda-forge
aws-c-event-stream        0.2.7               h70e1b0c_13    conda-forge
aws-c-io                  0.10.5               h2fe331c_0    conda-forge
aws-checksums             0.1.11               h1e232aa_7    conda-forge
aws-sdk-cpp               1.8.186              hb0612c5_3    conda-forge
blosc                     1.21.0               h0e60522_0    conda-forge
boost-cpp                 1.74.0               h9f4b32c_7    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
c-ares                    1.18.1               h8ffe710_0    conda-forge
ca-certificates           2021.10.8            h5b45459_0    conda-forge
cairo                     1.16.0            h15b3021_1009    conda-forge
cfitsio                   4.0.0                hd67004f_0    conda-forge
clang                     12.0.1               h8e541a6_4    conda-forge
clang-12                  12.0.1          default_h81446c8_4    conda-forge
clang-format              12.0.1          default_h81446c8_4    conda-forge
clang-tools               12.0.1          default_h81446c8_4    conda-forge
clangdev                  12.0.1          default_h5c34c98_4    conda-forge
clangxx                   12.0.1          default_h81446c8_4    conda-forge
cmake                     3.21.3               h39d44d4_0    conda-forge
curl                      7.81.0               h789b8ee_0    conda-forge
cyrus-sasl                2.1.27               h6c6f470_5    conda-forge
double-conversion         3.2.0                h0e60522_0    conda-forge
expat                     2.4.4                h39d44d4_0    conda-forge
fmt                       8.1.1                h5362a0b_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.13.96              h1989441_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.10.4               h546665d_1    conda-forge
freexl                    1.0.6                ha8e266a_0    conda-forge
geos                      3.10.2               h39d44d4_0    conda-forge
geotiff                   1.7.0                h144821f_6    conda-forge
gettext                   0.19.8.1          ha2e2712_1008    conda-forge
gflags                    2.2.2             ha925a31_1004    conda-forge
glog                      0.5.0                h4797de2_0    conda-forge
go                        1.17.6               hf68ea12_0    conda-forge
go-cgo                    1.17.6               h06338d3_0    conda-forge
grpc-cpp                  1.42.0               ha2e5525_1    conda-forge
hdf4                      4.2.15               h0e5069d_3    conda-forge
hdf5                      1.12.1          nompi_h2a0e4a3_103    conda-forge
icu                       69.1                 h0e60522_0    conda-forge
intel-openmp              2022.0.0          h57928b3_3663    conda-forge
jbig                      2.1               h8d14728_2003    conda-forge
jpeg                      9e                   h8ffe710_0    conda-forge
kealib                    1.4.14               h8995ca9_3    conda-forge
krb5                      1.19.2               h20d022d_3    conda-forge
lcms2                     2.12                 h2a16943_0    conda-forge
lerc                      3.0                  h0e60522_0    conda-forge
libarchive                3.5.2                hb45042f_1    conda-forge
libblas                   3.9.0              13_win64_mkl    conda-forge
libbrotlicommon           1.0.9                h8ffe710_6    conda-forge
libbrotlidec              1.0.9                h8ffe710_6    conda-forge
libbrotlienc              1.0.9                h8ffe710_6    conda-forge
libcblas                  3.9.0              13_win64_mkl    conda-forge
libclang                  12.0.1          default_h81446c8_4    conda-forge
libclang-cpp              12.0.1          default_h5c34c98_4    conda-forge
libcurl                   7.81.0               h789b8ee_0    conda-forge
libdb                     6.2.32               h39d44d4_0    conda-forge
libdeflate                1.8                  h8ffe710_0    conda-forge
libevent                  2.1.10               h6a571f8_4    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libgdal                   3.4.1                hb08d4f8_2    conda-forge
libglib                   2.70.2               h3be07f2_2    conda-forge
libiconv                  1.16                 he774522_0    conda-forge
libkml                    1.3.0             h9859afa_1014    conda-forge
liblapack                 3.9.0              13_win64_mkl    conda-forge
libllvm12                 12.0.1               hab3b255_2    conda-forge
libnetcdf                 4.8.1           nompi_h1cc8e9d_101    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libpq                     14.1                 hfcc5ef8_1    conda-forge
libprotobuf               3.19.4               h7755175_0    conda-forge
librdkafka                1.8.2.post2          h57a60f6_0    conda-forge
librttopo                 1.1.0                hb1df466_9    conda-forge
libspatialite             5.0.1               hc2703d3_14    conda-forge
libssh2                   1.10.0               h680486a_2    conda-forge
libthrift                 0.15.0               h636ae23_1    conda-forge
libtiff                   4.3.0                hd413186_2    conda-forge
libutf8proc               2.7.0                hcb41399_0    conda-forge
libwebp-base              1.2.2                h8ffe710_1    conda-forge
libxml2                   2.9.12               hf5bbc77_1    conda-forge
libzip                    1.8.0                hfed4ece_1    conda-forge
libzlib                   1.2.11            h8ffe710_1013    conda-forge
llvm                      12.0.1               h6fda50d_2    conda-forge
llvm-tools                12.0.1               ha327e53_2    conda-forge
llvmdev                   12.0.1               hab3b255_2    conda-forge
lz4-c                     1.9.3                h8ffe710_1    conda-forge
lzo                       2.10              he774522_1000    conda-forge
m2w64-binutils            2.25.1                        5    conda-forge
m2w64-bzip2               1.0.6                         6    conda-forge
m2w64-crt-git             5.0.0.4636.2595836               2    conda-forge
m2w64-gcc                 5.3.0                         6    conda-forge
m2w64-gcc-ada             5.3.0                         6    conda-forge
m2w64-gcc-fortran         5.3.0                         6    conda-forge
m2w64-gcc-libgfortran     5.3.0                         6    conda-forge
m2w64-gcc-libs            5.3.0                         7    conda-forge
m2w64-gcc-libs-core       5.3.0                         7    conda-forge
m2w64-gcc-objc            5.3.0                         6    conda-forge
m2w64-gmp                 6.1.0                         2    conda-forge
m2w64-headers-git         5.0.0.4636.c0ad18a               2    conda-forge
m2w64-isl                 0.16.1                        2    conda-forge
m2w64-libiconv            1.14                          6    conda-forge
m2w64-libmangle-git       5.0.0.4509.2e5a9a2               2    conda-forge
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    conda-forge
m2w64-make                4.1.2351.a80a8b8               2    conda-forge
m2w64-mpc                 1.0.3                         3    conda-forge
m2w64-mpfr                3.1.4                         4    conda-forge
m2w64-pkg-config          0.29.1                        2    conda-forge
m2w64-toolchain           5.3.0                         7    conda-forge
m2w64-toolchain_win-64    2.4.0                         0    conda-forge
m2w64-tools-git           5.0.0.4592.90b8472               2    conda-forge
m2w64-windows-default-manifest 6.4                           3    conda-forge
m2w64-winpthreads-git     5.0.0.4634.697f757               2    conda-forge
m2w64-zlib                1.2.8                        10    conda-forge
make                      4.3                  h3d2af85_1    conda-forge
maven                     3.6.3                h57928b3_0    conda-forge
mkl                       2022.0.0           h0e2418a_796    conda-forge
msys2-conda-epoch         20160418                      1    conda-forge
ninja                     1.10.2               h2d74725_1    conda-forge
numpy                     1.22.2           py39h6331f09_0    conda-forge
openjdk                   11.0.9.1             h57928b3_1    conda-forge
openjpeg                  2.4.0                hb211442_1    conda-forge
openssl                   1.1.1l               h8ffe710_0    conda-forge
pcre                      8.45                 h0e60522_0    conda-forge
pip                       22.0.3             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h8ffe710_0    conda-forge
poppler                   21.11.0              h24fffdf_0    conda-forge
poppler-data              0.4.11               hd8ed1ab_0    conda-forge
postgresql                14.1                 h1c22c4f_1    conda-forge
proj                      8.2.1                h1cfcee9_0    conda-forge
python                    3.9.10          h9a09f29_2_cpython    conda-forge
python_abi                3.9                      2_cp39    conda-forge
re2                       2021.11.01           h0e60522_0    conda-forge
setuptools                60.8.1           py39hcbf5309_0    conda-forge
snappy                    1.1.8                ha925a31_3    conda-forge
sqlite                    3.37.0               h8ffe710_0    conda-forge
tbb                       2021.5.0             h2d74725_0    conda-forge
tbb-devel                 2021.5.0             h2d74725_0    conda-forge
thrift-cpp                0.13.0               h669e017_5    conda-forge
tiledb                    2.6.2                h95dad36_1    conda-forge
tk                        8.6.11               h8ffe710_1    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
ucrt                      10.0.20348.0         h57928b3_0    conda-forge
vc                        14.2                 hb210afc_6    conda-forge
vs2013_runtime            12.0.21005                    1    defaults
vs2015_runtime            14.29.30037          h902a5da_6    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
winflexbison              2.5.22               he025d50_0    conda-forge
xerces-c                  3.2.3                h0e60522_4    conda-forge
xz                        5.2.5                h62dcd97_1    conda-forge
zlib                      1.2.11            h8ffe710_1013    conda-forge
zstd                      1.5.2                h6255e5f_0    conda-forge

Additional Context

https://github.com/conda-incubator/conda-libmamba-solver/pull/7#issuecomment-1046744617

beenje commented 1 year ago

I ran into the same issue:

$ conda create -y -n myapp python=3.10 flask
$ conda list -n myapp | grep flask
flask                     2.2.2              pyhd8ed1ab_0    conda-forge

$ conda update -n myapp --quiet  --solver classic flask
# All requested packages already installed.

$ conda update -n myapp --quiet  --solver libmamba flask
The following packages will be DOWNGRADED:

  flask                                  2.2.2-pyhd8ed1ab_0 --> 2.2.1-pyhd8ed1ab_0

This is with conda 22.11.1 and conda-libmamba-solver 22.12.0

costrouc commented 1 year ago

@beenje that is a really helpful example. I was able to reproduce. To help here are the libsolve instructions which might help to resolve. I've been spending some time trying to better understand the logic that https://github.com/conda/conda-libmamba-solver/blob/main/conda_libmamba_solver/solver.py#L332 does which is the state presented to libsolve.

conda create -y -n myapp python=3.10 flask
task: INSTALL 256
 - flask
 - python=3.10
$ conda list -n myapp | grep flask
flask                     2.2.3              pyhd8ed1ab_0    conda-forge
$  conda update -n myapp --quiet  --solver libmamba flask

Stage 1

USERINSTALLED 2560
 - conda-forge/noarch::flask==2.2.3=pyhd8ed1ab_0
 - conda-forge/linux-64::python==3.10.9=he550d4f_0_cpython
 - conda-forge/linux-64::ca-certificates==2022.12.7=ha878542_0
 - conda-forge/linux-64::openssl==3.1.0=h0b41bf4_0
task: UPDATE | ESSENTIAL 131840
 - flask!=2.2.3
 - conda-forge/linux-64::python==3.10.9=he550d4f_0_cpython
 - ca-certificates
 - openssl
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    flask-2.2.2                |     pyhd8ed1ab_0          74 KB  conda-forge
    ------------------------------------------------------------
                                           Total:          74 KB

The following packages will be DOWNGRADED:

  flask                                  2.2.3-pyhd8ed1ab_0 --> 2.2.2-pyhd8ed1ab_0