conda / conda-lock

Lightweight lockfile for conda environments

Home Page:https://conda.github.io/conda-lock/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ensureconda fails under python 3.12; Patch available

jfrost-mo opened this issue · comments

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

conda-lock doesn't run under python 3.12 as ensureconda crashes.

ensureconda is currently broken under python 3.12 due to using the now removed distutils. This is detailed in conda-incubator/ensureconda#24 and a fix is available in conda-incubator/ensureconda#22 but needs to be merged.

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/bin/conda-lock", line 5, in <module>
    from conda_lock import main
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/conda_lock/__init__.py", line 3, in <module>
    from conda_lock.conda_lock import main
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/conda_lock/conda_lock.py", line 38, in <module>
    from ensureconda.api import ensureconda
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/ensureconda/__init__.py", line 2, in <module>
    from .api import ensureconda
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/ensureconda/api.py", line 2, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

Conda Info

Conda info output
active environment : cset-312
    active env location : /data/users/jfrost/conda/envs/cset-312
            shell level : 1
       user config file : /home/h02/jfrost/.condarc
 populated config files : /etc/conda/condarc
                          /net/home/h02/jfrost/.condarc
          conda version : 23.7.4
    conda-build version : not installed
         python version : 3.10.4.final.0
       virtual packages : __archspec=1=x86_64
                          __glibc=2.17=0
                          __linux=3.10.0=0
                          __unix=0=0
       base environment : /opt/conda  (read only)
      conda av data dir : /opt/conda/etc/conda
  conda av metadata url : None
           channel URLs : https://**INTERNAL_URL**/conda/conda-forge/linux-64
                          https://**INTERNAL_URL**/conda/conda-forge/noarch
                          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
                          https://**INTERNAL_URL**/conda/conda-main/linux-64
                          https://**INTERNAL_URL**/conda/conda-main/noarch
                          https://**INTERNAL_URL**/conda/**INTERNAL_CHANNEL**/linux-64
                          https://**INTERNAL_URL**/conda/**INTERNAL_CHANNEL**/noarch
                          https:/**INTERNAL_URL**/conda/conda-r/linux-64
                          https:/**INTERNAL_URL**/conda/conda-r/noarch
          package cache : /data/users/jfrost/conda/pkgs
                          /home/h02/jfrost/.conda/pkgs
       envs directories : /data/users/jfrost/conda/envs
                          /home/h02/jfrost/.conda/envs
                          /opt/scitools/conda/environments
                          /opt/conda/envs
               platform : linux-64
             user-agent : conda/23.7.4 requests/2.31.0 CPython/3.10.4 Linux/3.10.0-1160.102.1.el7.x86_64 rhel/7.9 glibc/2.17
                UID:GID : 12436:1000
             netrc file : /home/h02/jfrost/.netrc
           offline mode : False

Conda Config

Conda config output
==> /etc/conda/condarc <==
auto_activate_base: False
envs_dirs:
  - ~/.conda/envs
  - /opt/scitools/conda/environments
pkgs_dirs:
  - ~/.conda/pkgs
ssl_verify: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
channel_alias: https://**INTERNAL_URL**/conda
channels:
  - conda-main
  - conda-mo-internal
  - conda-forge
  - conda-r
==> /net/home/h02/jfrost/.condarc <==
auto_activate_base: False
envs_dirs:
  - /data/users/jfrost/conda/envs
pkgs_dirs:
  - /data/users/jfrost/conda/pkgs
channel_priority: strict
channels:
  - conda-forge
  - defaults
solver: classic
==> cmd_line <==
debug: False
json: False

Additional Context

This is especially noticable now that GitHub has updated their runners to use python 3.12 by default.

Ensureconda has been fixed in version 1.4.4, so this now just requires updating ensureconda.

We should probably also fix #596 here.