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

Older versions of conda-build don't work with conda due to removed get_prefix #5026

Closed
2 tasks done
cafhach opened this issue Oct 5, 2023 · 3 comments
Closed
2 tasks done
Assignees
Labels
in-progress issue is actively being worked on locked [bot] locked due to inactivity type::bug describes erroneous operation, use severity::* to classify the type

Comments

@cafhach
Copy link

cafhach commented Oct 5, 2023

Checklist

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

What happened?

Disclaimer:
I would like to put this here not to seek a solution from the conda-build side but to document the solution for others who run into the same issue. The only solution I can think of would be to do bugfix releases for multiple previous conda-build versions in which a version requirement like conda<=3.29 would be introduced. This seems not feasable though.

Issue:
Using conda 23.9.0 with conda-build 3.21.9 causes the following error upon running conda build. The issue seems to be caused by an API change in conda, which removed the get_prefix function (although I could only track down a deprecation so far).

 File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/conda_interface.py", line 14, in try_exports
    return getattr(import_module('conda.exports'), attr)
AttributeError: module 'conda.exports' has no attribute 'get_prefix'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "[...]/conda_build_env/bin/conda-build", line 7, in <module>
    from conda_build.cli.main_build import main
  File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 18, in <module>
    import conda_build.api as api
  File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/api.py", line 22, in <module>
    from conda_build.config import (Config, get_or_merge_config, get_channel_urls,
  File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/config.py", line 15, in <module>
    from .conda_interface import root_dir, root_writable
  File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/conda_interface.py", line 119, in <module>
    context_get_prefix = try_exports("conda.base.context", "get_prefix")
  File "[...]/conda_build_env/lib/python3.9/site-packages/conda_build/conda_interface.py", line 16, in try_exports
    return getattr(import_module(module), attr)
AttributeError: module 'conda.base.context' has no attribute 'get_prefix'

Solution:

Update conda-build to >= 3.27

Conda Info

active environment : [...]/conda_build_env
    active env location : [...]/conda_build_env
            shell level : 2
       user config file : [...]/.condarc
 populated config files : [...]/.condarc
          conda version : 22.9.0
    conda-build version : 3.21.7
         python version : 3.8.3.final.0
       virtual packages : __cuda=11.4=0
                          __linux=5.4.0=0
                          __glibc=2.27=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : [...]/miniconda3  (read only)
      conda av data dir : [...]/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : http://[...]/c/jl4conda/linux-64
                          http://[...]/c/jl4conda/noarch
                          https://repo.anaconda.cloud/repo/main/linux-64
                          https://repo.anaconda.cloud/repo/main/noarch
                          https://repo.anaconda.cloud/repo/r/linux-64
                          https://repo.anaconda.cloud/repo/r/noarch
                          https://repo.anaconda.cloud/repo/msys2/linux-64
                          https://repo.anaconda.cloud/repo/msys2/noarch
                          https://conda.anaconda.org/services/linux-64
                          https://conda.anaconda.org/services/noarch
                          http://[...]/c/trusted-external-packages/linux-64
                          http://[...]/c/trusted-external-packages/noarch
          package cache : [...]/miniconda3/pkgs
                          [...]/.conda/pkgs
       envs directories : [...]/.conda/envs
                          [...]/miniconda3/envs
               platform : linux-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.8.3 Linux/5.4.0-150-generic ubuntu/18.04.6 glibc/2.27
                UID:GID : 206700:91189
             netrc file : None
           offline mode : False

Conda Config

==> [...]/.condarc <==
extra_safety_checks: False
add_anaconda_token: True
channels:
  - http://[...]/c/jl4conda
  - defaults
  - services
  - http://[...]/c/trusted-external-packages
default_channels:
  - https://repo.anaconda.cloud/repo/main
  - https://repo.anaconda.cloud/repo/r
  - https://repo.anaconda.cloud/repo/msys2
restore_free_channel: False

Conda list

# packages in environment at [...]/conda_build_env:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             5.1                       1_gnu    defaults
backports                 1.1                pyhd3eb1b0_0    defaults
backports.functools_lru_cache 1.6.4              pyhd3eb1b0_0    defaults
backports.tempfile        1.0                pyhd3eb1b0_1    defaults
backports.weakref         1.0.post1                  py_1    defaults
beautifulsoup4            4.12.2           py39h06a4308_0    defaults
blas                      1.0                         mkl    defaults
boltons                   23.0.0           py39h06a4308_0    defaults
brotlipy                  0.7.0           py39h27cfd23_1003    defaults
bzip2                     1.0.8                h7b6447c_0    defaults
ca-certificates           2023.08.22           h06a4308_0    defaults
certifi                   2023.7.22        py39h06a4308_0    defaults
cffi                      1.15.1           py39h5eee18b_3    defaults
chardet                   4.0.0           py39h06a4308_1003    defaults
charset-normalizer        2.0.4              pyhd3eb1b0_0    defaults
click                     8.0.4            py39h06a4308_0    defaults
conda                     23.9.0           py39h06a4308_0    defaults
conda-build               3.21.9           py39h06a4308_0    defaults
conda-package-handling    2.2.0            py39h06a4308_0    defaults
conda-package-streaming   0.9.0            py39h06a4308_0    defaults
conda-verify              3.4.2                      py_1    defaults
cryptography              41.0.3           py39hdda0065_0    defaults
distlib                   0.3.7                    pypi_0    pypi
exceptiongroup            1.0.4            py39h06a4308_0    defaults
filelock                  3.12.4                   pypi_0    pypi
future                    0.18.3           py39h06a4308_0    defaults
glob2                     0.7                pyhd3eb1b0_0    defaults
icu                       73.1                 h6a678d5_0    defaults
idna                      3.4              py39h06a4308_0    defaults
iniconfig                 1.1.1              pyhd3eb1b0_0    defaults
intel-openmp              2023.1.0         hdb19cb5_46305    defaults
jinja2                    3.1.2            py39h06a4308_0    defaults
jsonpatch                 1.32               pyhd3eb1b0_0    defaults
jsonpointer               2.1                pyhd3eb1b0_0    defaults
ld_impl_linux-64          2.38                 h1181459_1    defaults
libarchive                3.6.2                h6ac8c49_2    defaults
libffi                    3.4.4                h6a678d5_0    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libgomp                   11.2.0               h1234567_1    defaults
liblief                   0.12.3               h6a678d5_0    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
libxml2                   2.10.4               hf1b16e4_1    defaults
lz4-c                     1.9.4                h6a678d5_0    defaults
markupsafe                2.1.1            py39h7f8727e_0    defaults
mkl                       2023.1.0         h213fc3f_46343    defaults
mkl-service               2.4.0            py39h5eee18b_1    defaults
mkl_fft                   1.3.8            py39h5eee18b_0    defaults
mkl_random                1.2.4            py39hdb19cb5_0    defaults
ncurses                   6.4                  h6a678d5_0    defaults
numpy                     1.21.5           py39hf6e8229_4    defaults
numpy-base                1.21.5           py39h060ed82_4    defaults
openssl                   3.0.11               h7f8727e_2    defaults
packaging                 23.1             py39h06a4308_0    defaults
patchelf                  0.17.2               h6a678d5_0    defaults
pip                       23.2.1           py39h06a4308_0    defaults
pkginfo                   1.9.6            py39h06a4308_0    defaults
platformdirs              3.11.0                   pypi_0    pypi
pluggy                    1.0.0            py39h06a4308_1    defaults
psutil                    5.9.0            py39h5eee18b_0    defaults
py                        1.11.0                   pypi_0    pypi
py-lief                   0.12.3           py39h6a678d5_0    defaults
pybind11-stubgen          0.14.0                   pypi_0    pypi
pycosat                   0.6.4            py39h5eee18b_0    defaults
pycparser                 2.21               pyhd3eb1b0_0    defaults
pyopenssl                 23.2.0           py39h06a4308_0    defaults
pysocks                   1.7.1            py39h06a4308_0    defaults
pytest                    7.4.0            py39h06a4308_0    defaults
python                    3.9.18               h955ad1f_0    defaults
python-libarchive-c       2.9                pyhd3eb1b0_1    defaults
pytz                      2023.3.post1     py39h06a4308_0    defaults
pyyaml                    6.0              py39h5eee18b_1    defaults
readline                  8.2                  h5eee18b_0    defaults
requests                  2.31.0           py39h06a4308_0    defaults
ripgrep                   13.0.0               h35604bb_1    defaults
ruamel.yaml               0.17.21          py39h5eee18b_0    defaults
ruamel.yaml.clib          0.2.6            py39h5eee18b_1    defaults
setuptools                68.0.0           py39h06a4308_0    defaults
six                       1.16.0             pyhd3eb1b0_1    defaults
soupsieve                 2.5              py39h06a4308_0    defaults
sqlite                    3.41.2               h5eee18b_0    defaults
tbb                       2021.8.0             hdb19cb5_0    defaults
tk                        8.6.12               h1ccaba5_0    defaults
toml                      0.10.2                   pypi_0    pypi
tomli                     2.0.1            py39h06a4308_0    defaults
tox                       3.20.0                   pypi_0    pypi
tqdm                      4.65.0           py39hb070fc8_0    defaults
tzdata                    2023c                h04d1e81_0    defaults
urllib3                   1.26.16          py39h06a4308_0    defaults
virtualenv                20.24.5                  pypi_0    pypi
wheel                     0.41.2           py39h06a4308_0    defaults
xz                        5.4.2                h5eee18b_0    defaults
yaml                      0.2.5                h7b6447c_0    defaults
zlib                      1.2.13               h5eee18b_0    defaults
zstandard                 0.19.0           py39h5eee18b_0    defaults
zstd                      1.5.5                hc292b87_0    defaults

Additional Context

No response

@cafhach cafhach added the type::bug describes erroneous operation, use severity::* to classify the type label Oct 5, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Oct 5, 2023
@dholth
Copy link
Contributor

dholth commented Oct 5, 2023

We can patch the metadata to add the required dependency information.

@jakirkham
Copy link
Member

jakirkham commented Oct 6, 2023

Have seen the same issue when re-rendering with conda-smithy (as it uses conda-build to run conda render effectively)

This gets a little tricky because the newest conda-build, boa & mamba have incompatibilities: conda-forge/boa-feedstock#73 (comment)

Also related: mamba-org/mamba#2882 (comment)

So end up needing to stick with conda version 23.7.4 atm

cc @jaimergp (for awareness)

@dholth
Copy link
Contributor

dholth commented Oct 10, 2023

This issue has been fixed in three ways. Repodata hotfixes from conda-build tightened the upper bound of conda's on conda-build. Anaconda approached it from the opposite direction, patching conda's metadata to constrain conda-build >=3.27. Successive releases of conda will include that constraint.

So from now on the solver should prevent conda 23.9 from being installed at the same time as conda-build < 23.7.

@dholth dholth closed this as completed Oct 10, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to 🏁 Done in 🧭 Planning Oct 10, 2023
@dholth dholth added the in-progress issue is actively being worked on label Oct 10, 2023
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
in-progress issue is actively being worked on locked [bot] locked due to inactivity type::bug describes erroneous operation, use severity::* to classify the type
Projects
Archived in project
Development

No branches or pull requests

3 participants