Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda-lock hangs with a combination of python 3.11 and dsub 0.4.9 #619

Open
2 tasks done
aaymeloglu opened this issue Mar 16, 2024 · 8 comments
Open
2 tasks done

Comments

@aaymeloglu
Copy link

Checklist

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

What happened?

When I run conda-lock -p osx-arm64 -f environment.yml -k env with the following environment.yml file, it hangs indefinitely.

name: myenv
channels:
- conda-forge
dependencies:
- pip=24.0
- python=3.11.8
- pip:
  - dsub==0.4.8

If I change the python version to 3.10.13, it completes. If I change the dsub version to 0.4.7 or earlier, it completes. 0.4.8 or later fails. If I run conda env update -f environment.yml (conda version 24.1.2) it builds the environment successfully.

Conda Info

active environment : base
    active env location : /Users/aaymeloglu/miniconda3
            shell level : 1
       user config file : /Users/aaymeloglu/.condarc
 populated config files : /Users/aaymeloglu/.condarc
          conda version : 24.1.2
    conda-build version : not installed
         python version : 3.11.8.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=m1
                          __conda=24.1.2=0
                          __osx=14.2.1=0
                          __unix=0=0
       base environment : /Users/aaymeloglu/miniconda3  (writable)
      conda av data dir : /Users/aaymeloglu/miniconda3/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/aaymeloglu/miniconda3/pkgs
                          /Users/aaymeloglu/.conda/pkgs
       envs directories : /Users/aaymeloglu/miniconda3/envs
                          /Users/aaymeloglu/.conda/envs
               platform : osx-arm64
             user-agent : conda/24.1.2 requests/2.31.0 CPython/3.11.8 Darwin/23.2.0 OSX/14.2.1 solver/libmamba conda-libmamba-solver/23.12.0 libmambapy/1.5.7
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Conda Config

==> /Users/aaymeloglu/.condarc <==
subdirs: []
channel_priority: strict
channels:
  - conda-forge
  - defaults

Conda list

# packages in environment at /Users/aaymeloglu/miniconda3:
#
# Name                    Version                   Build  Channel
archspec                  0.2.1              pyhd3eb1b0_0    defaults
boltons                   23.0.0          py311hca03da5_0    defaults
brotli-python             1.0.9           py311h313beb8_7    defaults
bzip2                     1.0.8                h620ffc9_4    defaults
c-ares                    1.27.0               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          py311h80987f9_0    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
conda                     24.1.2          py311h267d04e_0    conda-forge
conda-content-trust       0.2.0           py311hca03da5_0    defaults
conda-libmamba-solver     23.12.0            pyhd3eb1b0_1    defaults
conda-package-handling    2.2.0           py311hca03da5_0    defaults
conda-package-streaming   0.9.0           py311hca03da5_0    defaults
cryptography              41.0.7          py311hd4332d6_0    defaults
distro                    1.8.0           py311hca03da5_0    defaults
fmt                       10.2.1               h2ffa867_0    conda-forge
icu                       73.2                 hc8870d7_0    conda-forge
idna                      3.4             py311hca03da5_0    defaults
jsonpatch                 1.32               pyhd3eb1b0_0    defaults
jsonpointer               2.1                pyhd3eb1b0_0    defaults
krb5                      1.21.2               h92f50d5_0    conda-forge
libarchive                3.7.2                hcacb583_1    conda-forge
libcurl                   8.5.0                h2d989ff_0    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libedit                   3.1.20230828         h80987f9_0    defaults
libev                     4.33                 h1a28f6b_1    defaults
libexpat                  2.5.0                hb7217d7_1    conda-forge
libffi                    3.4.4                hca03da5_0    defaults
libiconv                  1.17                 h0d3ecfb_2    conda-forge
libmamba                  1.5.7                h90c426b_0    conda-forge
libmambapy                1.5.7           py311h26e1311_0    conda-forge
libnghttp2                1.58.0               ha4dd798_1    conda-forge
libsolv                   0.7.24               h514c7bf_0    defaults
libsqlite                 3.45.1               h091b4b1_0    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libxml2                   2.12.5               h0d0cfa8_0    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
lz4-c                     1.9.4                h313beb8_0    defaults
lzo                       2.10              h642e427_1000    conda-forge
mamba                     1.5.7           py311hb045da1_0    conda-forge
menuinst                  2.0.1           py311hca03da5_1    defaults
ncurses                   6.4                  h313beb8_0    defaults
openssl                   3.2.1                h0d3ecfb_0    conda-forge
packaging                 23.1            py311hca03da5_0    defaults
pcre2                     10.42                hb066dcc_0    defaults
pip                       23.3.1          py311hca03da5_0    defaults
platformdirs              3.10.0          py311hca03da5_0    defaults
pluggy                    1.0.0           py311hca03da5_1    defaults
pybind11-abi              4                    hd3eb1b0_1    defaults
pycosat                   0.6.6           py311h80987f9_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyopenssl                 23.2.0          py311hca03da5_0    defaults
pysocks                   1.7.1           py311hca03da5_0    defaults
python                    3.11.8          hdf0ec26_0_cpython    conda-forge
python.app                3               py311h80987f9_0    defaults
python_abi                3.11                    4_cp311    conda-forge
readline                  8.2                  h1a28f6b_0    defaults
reproc                    14.2.4               hc377ac9_1    defaults
reproc-cpp                14.2.4               hc377ac9_1    defaults
requests                  2.31.0          py311hca03da5_0    defaults
ruamel.yaml               0.17.21         py311h80987f9_0    defaults
setuptools                68.2.2          py311hca03da5_0    defaults
sqlite                    3.41.2               h80987f9_0    defaults
tk                        8.6.13               h5083fa2_1    conda-forge
tqdm                      4.65.0          py311hb6e6a13_0    defaults
truststore                0.8.0           py311hca03da5_0    defaults
tzdata                    2023c                h04d1e81_0    defaults
urllib3                   1.26.18         py311hca03da5_0    defaults
wheel                     0.41.2          py311hca03da5_0    defaults
xz                        5.4.5                h80987f9_0    defaults
yaml-cpp                  0.8.0                h313beb8_0    defaults
zlib                      1.2.13               h53f4e23_5    conda-forge
zstandard                 0.19.0          py311h80987f9_0    defaults
zstd                      1.5.5                hd90d995_0    defaults

Additional Context

No response

@zmbc
Copy link

zmbc commented Mar 19, 2024

I see this as well with just:

name: my_env
channels:
  - conda-forge
dependencies:
  - python
  - pip
  - pip:
      - poetry

Running with --log-level DEBUG, the last line it prints before hanging is always DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org:443. I am guessing that no timeout is being set, as described in this issue; if a lot of requests are made, one is bound to fail, and it will just wait forever.

@zmbc
Copy link

zmbc commented Mar 19, 2024

This was fixed upstream in Poetry here: python-poetry/poetry#5881

@jxu10
Copy link

jxu10 commented Mar 20, 2024

conda-lock solves after adding an explicit specifier for google-api-core[grpc] (dsub 0.4.8 specifies google-api-core>=2.7.3,<=2.11.0):

name: myenv
channels:
  - conda-forge
dependencies:
  - pip=24.0
  - python=3.11.8
  - pip:
      - dsub==0.4.8
      - google-api-core[grpc]>=2.7.3,<=2.11.0

It appears that the vendored Poetry has issues handling pip package extras, and the Poetry solver infinitely loops if both google-api-core and google-api-core[grpc] are sub-dependencies in the dependency tree.

I haven't tested, but #613 may help.

@matthewfeickert
Copy link

matthewfeickert commented Oct 3, 2024

I think I'm experiencing the same thing with conda-lock v2.5.7 and the following minimal environment.yml (here named example.yml):

name: servicex-conda-lock-failure 
channels:
- conda-forge
dependencies:
- python=3.11
- pip
- pip:
  - servicex>=3.0.0

As seen in this minimal failing example below, I'm able to create a new environment from example.yml using mamba env create in under 30 seconds. However, when I try to have conda-lock v2.5.7 create a lock file from example.yml it will hang indefinitely (I let it run for more than 60 minutes before killing it locally, but in the example I kill it after 2 minutes).

$ docker pull condaforge/miniforge3:latest
$ docker run --rm -ti -v ./example.yml:/tmp/example.yml condaforge/miniforge3:latest
(base) root@4db92033a607:/# mamba init
(base) root@4db92033a607:/# . /root/.bashrc 
(base) root@4db92033a607:/# mamba --version
mamba 1.5.9
conda 24.7.1
(base) root@4db92033a607:/# time mamba env create --yes --file /tmp/example.yml
...
real	0m25.827s
user	0m19.124s
sys	0m2.730s
(base) root@4db92033a607:/# mamba run --name servicex-conda-lock-failure python -c 'import servicex; print(servicex)'
<module 'servicex' from '/opt/conda/envs/servicex-conda-lock-failure/lib/python3.11/site-packages/servicex/__init__.py'>

(base) root@4db92033a607:/# mamba create --name lock --yes conda-lock
(base) root@4db92033a607:/# mamba activate lock
(lock) root@4db92033a607:/# conda-lock --version
conda-lock, version 2.5.7
(lock) root@4db92033a607:/# timeout 120 conda-lock lock --mamba --platform linux-64 --kind lock --file /tmp/example.yml 
Locking dependencies for ['linux-64']...
INFO:conda_lock.conda_solver:linux-64 using specs ['python 3.11.*', 'pip *']
(lock) root@4db92033a607:/# echo $?
124

I guess this is fixed(?) given PR #637 and PR #678, but there is no post v2.5.7 release with the fix yet.

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

Hi @matthewfeickert, it works for me from the main branch, so I am hopeful that the problem has indeed been fixed by those PRs. I hope to cut a new release very soon.

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

If you'd be willing to test out main, that would be extremely useful in terms of fleshing out any real-world bugs that aren't being caught by the test suite.

pipx install --force git+https://github.com/conda/conda-lock@main

@matthewfeickert
Copy link

If you'd be willing to test out main, that would be extremely useful in terms of fleshing out any real-world bugs that aren't being caught by the test suite.

pipx install --force git+https://github.com/conda/conda-lock@main

@maresb, yeah the minimal failing example that I had now works on main

root@e49221b89d44:/# pipx install --force git+https://github.com/conda/conda-lock@main
...
root@e49221b89d44:/# timeout 120 conda-lock lock --platform linux-64 --kind lock --file /tmp/example.yml 
Locking dependencies for ['linux-64']...
INFO:conda_lock.conda_solver:linux-64 using specs ['python 3.11.*', 'pip *']
 - Install lock using: conda-lock install --name YOURENV conda-lock.yml
root@e49221b89d44:/# grep servicex conda-lock.yml 
- name: servicex
  url: https://files.pythonhosted.org/packages/61/d2/27ed7c70c289b9238266e25809cc4ef75a39808da8813dc6d92e293d432d/servicex-3.0.0-py3-none-any.whl

and if I extend that environment.yml to be something more common in real analysis workflows

name: iris-hep-py311
channels:
- conda-forge
dependencies:
- python 3.11.*
- uproot >=5.0.0
- hist >=2.7.0
- mplhep >=0.3.50
- cabinetry >=0.6.0
- coffea >=2024.1.0
- func-adl >=3.3.0
- xrootd >=5.7.0
- dask-awkward >=2024.1.0
- pip
- pip:
  - func-adl-servicex>=2.2
  - servicex>=3.0.0
  - fastjet>=3.4.0.0

the HEAD of main works there too. 👍

...
root@e49221b89d44:/# timeout 120 conda-lock lock --platform linux-64 --kind lock --file ./environment.yml 
Locking dependencies for ['linux-64']...
INFO:conda_lock.conda_solver:linux-64 using specs ['python 3.11.*', 'uproot >=5.0.0', 'hist >=2.7.0', 'mplhep >=0.3.50', 'cabinetry >=0.6.0', 'coffea >=2024.1.0', 'func-adl >=3.3.0', 'xrootd >=5.7.0', 'dask-awkward >=2024.1.0', 'pip *']
 - Install lock using: conda-lock install --name YOURENV conda-lock.yml

@maresb
Copy link
Contributor

maresb commented Oct 3, 2024

Many thanks for reporting back @matthewfeickert, I really appreciate it!!! This sort of report makes me more confident in cutting the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants