conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
456 stars 101 forks source link

conda-lock fails with micromamba and ensureconda 1.4.4 #596

Closed HedgehogCode closed 4 months ago

HedgehogCode commented 4 months ago

Checklist

What happened?

If I run

$ conda-lock --micromamba --no-mamba -f environment.yml -p linux-64

I get the error

Traceback (most recent call last):
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/bin/conda-lock", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 1398, in lock
    lock_func(
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 1103, in run_lock
    _conda_exe = determine_conda_executable(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/benjamin/miniconda3/envs/tmp-conda-lock/lib/python3.12/site-packages/conda_lock/invoke_conda.py", line 60, in determine_conda_executable
    if determine_micromamba_version(str(candidate)) < LooseVersion("0.17"):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'Version' and 'LooseVersion'

Conda Info

active environment : tmp-conda-lock
    active env location : /home/benjamin/miniconda3/envs/tmp-conda-lock
            shell level : 4
       user config file : /home/benjamin/.condarc
 populated config files : /home/benjamin/.condarc
          conda version : 23.1.0
    conda-build version : 3.21.9
         python version : 3.9.13.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.35=0
                          __linux=6.5.0=0
                          __unix=0=0
       base environment : /home/benjamin/miniconda3  (writable)
      conda av data dir : /home/benjamin/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/benjamin/miniconda3/pkgs
                          /home/benjamin/.conda/pkgs
       envs directories : /home/benjamin/miniconda3/envs
                          /home/benjamin/.conda/envs
               platform : linux-64
             user-agent : conda/23.1.0 requests/2.31.0 CPython/3.9.13 Linux/6.5.0-15-generic ubuntu/22.04.3 glibc/2.35 solver/libmamba conda-libmamba-solver/22.8.1 libmambapy/1.0.0
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

Conda Config

==> /home/benjamin/.condarc <==
solver: libmamba

Conda list

# packages in environment at /home/benjamin/miniconda3/envs/tmp-conda-lock:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
annotated-types           0.6.0              pyhd8ed1ab_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
brotli-python             1.1.0           py312h30efb56_1    conda-forge
bzip2                     1.0.8                hd590300_5    conda-forge
ca-certificates           2024.2.2             hbcca054_0    conda-forge
cachecontrol              0.14.0             pyhd8ed1ab_0    conda-forge
cachecontrol-with-filecache 0.14.0             pyhd8ed1ab_0    conda-forge
cachy                     0.3.0              pyhd8ed1ab_1    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py312hf06ca03_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
click                     8.1.7           unix_pyh707e725_0    conda-forge
click-default-group       1.2.4              pyhd8ed1ab_0    conda-forge
clikit                    0.6.2              pyhd8ed1ab_2    conda-forge
conda-lock                2.5.2              pyhd8ed1ab_0    conda-forge
crashtest                 0.4.1              pyhd8ed1ab_0    conda-forge
cryptography              42.0.2          py312h4742d6a_0    conda-forge
dbus                      1.13.6               h5008d03_3    conda-forge
distlib                   0.3.8              pyhd8ed1ab_0    conda-forge
ensureconda               1.4.4              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                hcb278e6_1    conda-forge
filelock                  3.13.1             pyhd8ed1ab_0    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gitdb                     4.0.11             pyhd8ed1ab_0    conda-forge
gitpython                 3.1.41             pyhd8ed1ab_0    conda-forge
html5lib                  1.1                pyh9f0ad1d_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
jaraco.classes            3.3.0              pyhd8ed1ab_0    conda-forge
jeepney                   0.8.0              pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
keyring                   24.3.0          py312h7900ff3_0    conda-forge
ld_impl_linux-64          2.40                 h41732ed_0    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 13.2.0               h807b86a_5    conda-forge
libglib                   2.78.3               h783c2da_0    conda-forge
libgomp                   13.2.0               h807b86a_5    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.44.2               h2797004_0    conda-forge
libstdcxx-ng              13.2.0               h7e041cc_5    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
markupsafe                2.1.5           py312h98912ed_0    conda-forge
micromamba                1.5.6                         0    conda-forge
more-itertools            10.2.0             pyhd8ed1ab_0    conda-forge
msgpack-python            1.0.7           py312h8572e83_0    conda-forge
ncurses                   6.4                  h59595ed_2    conda-forge
openssl                   3.2.1                hd590300_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pastel                    0.2.1              pyhd8ed1ab_0    conda-forge
pcre2                     10.42                hcad00b1_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pkginfo                   1.9.6              pyhd8ed1ab_0    conda-forge
platformdirs              4.2.0              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydantic                  2.6.0              pyhd8ed1ab_0    conda-forge
pydantic-core             2.16.1          py312h4b3b743_0    conda-forge
pylev                     1.4.0              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.12.1          hab00c5b_1_cpython    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pyyaml                    6.0.1           py312h98912ed_1    conda-forge
readline                  8.2                  h8228510_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
ruamel.yaml               0.18.5          py312h98912ed_0    conda-forge
ruamel.yaml.clib          0.2.7           py312h98912ed_2    conda-forge
secretstorage             3.3.3           py312h7900ff3_2    conda-forge
setuptools                69.0.3             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
smmap                     5.0.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tomlkit                   0.12.3             pyha770c72_0    conda-forge
toolz                     0.12.1             pyhd8ed1ab_0    conda-forge
typing-extensions         4.9.0                hd8ed1ab_0    conda-forge
typing_extensions         4.9.0              pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
urllib3                   1.26.18            pyhd8ed1ab_0    conda-forge
virtualenv                20.25.0            pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_2    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge

Additional Context

The bug is caused by a recent change from LooseVersion to Version in ensureconda: https://github.com/conda-incubator/ensureconda/pull/22 which was released with ensureconda 1.4.4.

maresb commented 4 months ago

Thanks so much for the report!

maresb commented 4 months ago

Closed by #597