Skip to content

Implicit metapackages causing IndexError via parse/raw warning #5699

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

Open
2 tasks done
ndevenish opened this issue Apr 24, 2025 · 1 comment · May be fixed by #5711
Open
2 tasks done

Implicit metapackages causing IndexError via parse/raw warning #5699

ndevenish opened this issue Apr 24, 2025 · 1 comment · May be fixed by #5711
Labels
type::bug describes erroneous operation, use severity::* to classify the type

Comments

@ndevenish
Copy link

ndevenish commented Apr 24, 2025

Checklist

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

What happened?

Ran into an issue trying to render a package (recipe) with conda-smithy; Filed conda-forge/conda-smithy#2306, but seems to be coming from conda-build. Trace:

Traceback (most recent call last):
  File "/Users/nickd/.local/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/cli.py", line 767, in main
    args.subcommand_func(args)
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/cli.py", line 608, in __call__
    self._call(args, tmpdir)
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/cli.py", line 613, in _call
    configure_feedstock.main(
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/configure_feedstock.py", line 2920, in main
    render_azure(env, config, forge_dir, return_metadata=True)
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/configure_feedstock.py", line 1935, in render_azure
    return _render_ci_provider(
           ^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/configure_feedstock.py", line 1237, in _render_ci_provider
    dump_subspace_config_files(
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/configure_feedstock.py", line 783, in dump_subspace_config_files
    configs, top_level_loop_vars = _collapse_subpackage_variants(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_smithy/configure_feedstock.py", line 577, in _collapse_subpackage_variants
    meta.get_used_loop_vars(force_top_level=True) for meta in list_of_metas
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_build/metadata.py", line 2807, in get_used_loop_vars
    used_vars = self.get_used_vars(
                ^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_build/metadata.py", line 2905, in get_used_vars
    meta_yaml_reqs = self._get_used_vars_meta_yaml(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_build/metadata.py", line 2980, in _get_used_vars_meta_yaml
    reqs_text, recipe_text = self._get_used_vars_meta_yaml_helper(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_build/metadata.py", line 2963, in _get_used_vars_meta_yaml_helper
    ) + self.extract_single_output_text(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/nickd/.condax/conda-smithy/lib/python3.12/site-packages/conda_build/metadata.py", line 2321, in extract_single_output_text
    output = output_matches[output_index] if output_matches else ""
             ~~~~~~~~~~~~~~^^^^^^^^^^^^^^
IndexError: list index out of range

The problem seems to come from the situation warned about in

if len(output_matches) != len(outputs):
# See https://github.com/conda/conda-build/issues/5571
utils.get_logger(__name__).warning(
"Number of parsed outputs does not match detected raw metadata blocks. "
"Identified output block may be wrong! "
"If you are using Jinja conditionals to include or exclude outputs, "
"consider using `skip: true # [condition]` instead."
)

The output_matches as parsed from recipe_text:

recipe_text = self.extract_outputs_text(apply_selectors=apply_selectors)
output_matches = output_re.findall(recipe_text)
only has three matches because recipe_text only includes the outputs: section, not the implicit metapackage from the top-level requirement (as documented here). So when the block below tries to output_matches[output_index] it fails because output_index == len(output_matches) (e.g. higher index).

This warning was added in 74dc428, and possibly #5655 is a symptom; if it's only counting output: sections now, then the lengths won't match but perhaps it can still find the zeroth package?

Moving to an explicit metapackage made the problem go away: conda-forge/hdf5-external-filter-plugins-feedstock@c0c9243

Conda Info

libmamba version : 2.1.0
          mamba version : 2.1.0
           curl version : libcurl/8.13.0 OpenSSL/3.5.0 (SecureTransport) zlib/1.3.1 zstd/1.5.7 libssh2/1.11.1 nghttp2/1.64.0
     libarchive version : libarchive 3.7.7 zlib/1.3.1 liblzma/5.6.3 bz2lib/1.0.8 liblz4/1.10.0 libzstd/1.5.6
       envs directories : /Users/nickd/.condax/mamba/envs
          package cache : /Users/nickd/.condax/mamba/pkgs
                          /Users/nickd/.mamba/pkgs
            environment : /Users/nickd/.condax/conda-smithy
           env location : /Users/nickd/.condax/conda-smithy
      user config files : /Users/nickd/.mambarc
 populated config files : /Users/nickd/.condax/conda-smithy/condarc
                          /Users/nickd/.condarc
                          /Users/nickd/.condax/mamba/condarc
       virtual packages : __unix=0=0
                          __osx=15.3.2=0
                          __archspec=1=arm64
               channels : https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-forge/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://conda.anaconda.org/nodefaults/noarch
                          https://conda.anaconda.org/nodefaults/osx-arm64
       base environment : /Users/nickd/.condax/mamba
               platform : osx-arm64

Conda Config

Conda list

List of packages in environment: "/Users/nickd/.condax/conda-smithy"

  Name                        Version              Build               Channel
────────────────────────────────────────────────────────────────────────────────────
  anyio                       4.9.0                pyh29332c3_0        conda-forge
  archspec                    0.2.5                pyhd8ed1ab_0        conda-forge
  attrs                       25.3.0               pyh71513ae_0        conda-forge
  backports                   1.0                  pyhd8ed1ab_5        conda-forge
  backports.strenum           1.3.1                haf276df_2          conda-forge
  backports.tarfile           1.2.0                pyhd8ed1ab_1        conda-forge
  beautifulsoup4              4.13.4               pyha770c72_0        conda-forge
  blinker                     1.9.0                pyhff2d567_0        conda-forge
  boltons                     24.0.0               pyhd8ed1ab_1        conda-forge
  boolean.py                  5.0                  pyhd8ed1ab_0        conda-forge
  brotli-python               1.1.0                py312hde4cb15_2     conda-forge
  bzip2                       1.0.8                h99b78c6_7          conda-forge
  c-ares                      1.34.5               h5505292_0          conda-forge
  ca-certificates             2025.1.31            hbd8a1cb_1          conda-forge
  cctools                     1010.6               hb4fb6a3_6          conda-forge
  cctools_osx-arm64           1010.6               h3b4f5d3_6          conda-forge
  certifi                     2025.1.31            pyhd8ed1ab_0        conda-forge
  cffi                        1.17.1               py312h0fad829_0     conda-forge
  chardet                     5.2.0                pyhd8ed1ab_3        conda-forge
  charset-normalizer          3.4.1                pyhd8ed1ab_0        conda-forge
  cirun                       0.30                 pyhd8ed1ab_1        conda-forge
  click                       8.1.8                pyh707e725_0        conda-forge
  colorama                    0.4.6                pyhd8ed1ab_1        conda-forge
  conda                       25.3.1               py312h81bd7bf_1     conda-forge
  conda-build                 25.4.2               py312h81bd7bf_0     conda-forge
  conda-forge-pinning         2025.04.23.13.34.55  hd8ed1ab_0          conda-forge
  conda-index                 0.6.0                pyhd8ed1ab_0        conda-forge
  conda-libmamba-solver       25.3.0               pyhd8ed1ab_0        conda-forge
  conda-package-handling      2.4.0                pyh7900ff3_2        conda-forge
  conda-package-streaming     0.11.0               pyhd8ed1ab_1        conda-forge
  conda-smithy                3.47.2               unix_pyhd81877a_0   conda-forge
  cpp-expected                1.1.0                h177bc72_1          conda-forge
  cryptography                44.0.2               py312hf9bd80e_0     conda-forge
  deprecated                  1.2.18               pyhd8ed1ab_0        conda-forge
  distlib                     0.3.9                pyhd8ed1ab_1        conda-forge
  distro                      1.9.0                pyhd8ed1ab_1        conda-forge
  editables                   0.5                  pyhd8ed1ab_1        conda-forge
  evalidate                   2.0.3                pyh29332c3_1        conda-forge
  exceptiongroup              1.2.2                pyhd8ed1ab_1        conda-forge
  filelock                    3.18.0               pyhd8ed1ab_0        conda-forge
  fmt                         11.1.4               h440487c_1          conda-forge
  frozendict                  2.4.6                py312h0bf5046_0     conda-forge
  git                         2.49.0               pl5321hd71a902_0    conda-forge
  gitdb                       4.0.12               pyhd8ed1ab_0        conda-forge
  gitpython                   3.1.44               pyhff2d567_0        conda-forge
  gmp                         6.3.0                h7bae524_2          conda-forge
  h11                         0.14.0               pyhd8ed1ab_1        conda-forge
  h2                          4.2.0                pyhd8ed1ab_0        conda-forge
  hatch                       1.14.1               pyhd8ed1ab_0        conda-forge
  hatchling                   1.27.0               pypyhd8ed1ab_0      conda-forge
  hpack                       4.1.0                pyhd8ed1ab_0        conda-forge
  httpcore                    1.0.7                pyh29332c3_1        conda-forge
  httpx                       0.28.1               pyhd8ed1ab_0        conda-forge
  hyperframe                  6.1.0                pyhd8ed1ab_0        conda-forge
  hyperlink                   21.0.0               pyh29332c3_1        conda-forge
  idna                        3.10                 pyhd8ed1ab_1        conda-forge
  importlib-metadata          8.6.1                pyha770c72_0        conda-forge
  importlib_resources         6.5.2                pyhd8ed1ab_0        conda-forge
  isodate                     0.7.2                pyhd8ed1ab_1        conda-forge
  jaraco.classes              3.4.0                pyhd8ed1ab_2        conda-forge
  jaraco.context              6.0.1                pyhd8ed1ab_0        conda-forge
  jaraco.functools            4.1.0                pyhd8ed1ab_0        conda-forge
  jinja2                      3.1.6                pyhd8ed1ab_0        conda-forge
  jsonpatch                   1.33                 pyhd8ed1ab_1        conda-forge
  jsonpointer                 3.0.0                py312h81bd7bf_1     conda-forge
  jsonschema                  4.23.0               pyhd8ed1ab_1        conda-forge
  jsonschema-specifications   2025.4.1             pyh29332c3_0        conda-forge
  keyring                     25.6.0               pyh534df25_0        conda-forge
  krb5                        1.21.3               h237132a_0          conda-forge
  ld64                        951.9                h4c6efb1_6          conda-forge
  ld64_osx-arm64              951.9                hb6b49e2_6          conda-forge
  libarchive                  3.7.7                h3b16cec_3          conda-forge
  libcurl                     8.13.0               h73640d1_0          conda-forge
  libcxx                      20.1.3               ha82da77_0          conda-forge
  libedit                     3.1.20250104         pl5321hafb1f1b_0    conda-forge
  libev                       4.33                 h93a5062_2          conda-forge
  libexpat                    2.7.0                h286801f_0          conda-forge
  libffi                      3.4.6                h1da3d7d_1          conda-forge
  libgit2                     1.9.0                h211146d_0          conda-forge
  libiconv                    1.18                 hfe07756_1          conda-forge
  libintl                     0.23.1               h493aca8_0          conda-forge
  liblief                     0.16.4               h286801f_0          conda-forge
  libllvm18                   18.1.8               default_hb458b26_5  conda-forge
  liblzma                     5.8.1                h39f12f2_0          conda-forge
  libmamba                    2.1.0                h7c3736b_0          conda-forge
  libmambapy                  2.1.0                py312h9b24f82_0     conda-forge
  libnghttp2                  1.64.0               h6d7220d_0          conda-forge
  libsodium                   1.0.20               h99b78c6_0          conda-forge
  libsolv                     0.7.30               h6c9b7f8_0          conda-forge
  libsqlite                   3.49.1               h3f77e49_2          conda-forge
  libssh2                     1.11.1               h9cc3647_0          conda-forge
  libxml2                     2.14.2               h3e1e5eb_0          conda-forge
  libzlib                     1.3.1                h8359307_2          conda-forge
  license-expression          30.4.1               pyhd8ed1ab_0        conda-forge
  llvm-tools                  18.1.8               default_hb458b26_5  conda-forge
  llvm-tools-18               18.1.8               default_hb458b26_5  conda-forge
  lz4-c                       1.10.0               h286801f_1          conda-forge
  lzo                         2.10                 h93a5062_1001       conda-forge
  markdown-it-py              3.0.0                pyhd8ed1ab_1        conda-forge
  markupsafe                  3.0.2                py312h998013c_1     conda-forge
  mbedtls                     3.5.1                h286801f_1          conda-forge
  mdurl                       0.1.2                pyhd8ed1ab_1        conda-forge
  menuinst                    2.2.0                py312h81bd7bf_0     conda-forge
  more-itertools              10.7.0               pyhd8ed1ab_0        conda-forge
  msgpack-python              1.1.0                py312h6142ec9_0     conda-forge
  msrest                      0.6.21               pyh44b312d_0        conda-forge
  ncurses                     6.5                  h5e97a16_3          conda-forge
  nlohmann_json               3.11.3               h00cdb27_1          conda-forge
  oauthlib                    3.2.2                pyhd8ed1ab_1        conda-forge
  openssl                     3.5.0                h81ee809_0          conda-forge
  packaging                   25.0                 pyh29332c3_1        conda-forge
  patch                       2.7.6                h27ca646_1002       conda-forge
  pathspec                    0.12.1               pyhd8ed1ab_1        conda-forge
  pcre2                       10.44                h297a79d_2          conda-forge
  perl                        5.32.1               7_h4614cfb_perl5    conda-forge
  pexpect                     4.9.0                pyhd8ed1ab_1        conda-forge
  pip                         25.0.1               pyh8b19718_0        conda-forge
  pkginfo                     1.12.1.2             pyhd8ed1ab_0        conda-forge
  pkgutil-resolve-name        1.3.10               pyhd8ed1ab_2        conda-forge
  platformdirs                4.3.7                pyh29332c3_0        conda-forge
  pluggy                      1.5.0                pyhd8ed1ab_1        conda-forge
  psutil                      7.0.0                py312hea69d52_0     conda-forge
  ptyprocess                  0.7.0                pyhd8ed1ab_1        conda-forge
  py-lief                     0.16.4               py312hd8f9ff3_0     conda-forge
  pybind11-abi                4                    hd8ed1ab_3          conda-forge
  pycosat                     0.6.6                py312hea69d52_2     conda-forge
  pycparser                   2.22                 pyh29332c3_1        conda-forge
  pycryptodome                3.22.0               py312ha135e06_0     conda-forge
  pygit2                      1.17.0               py312hd525726_0     conda-forge
  pygithub                    2.6.1                pyhd8ed1ab_0        conda-forge
  pygments                    2.19.1               pyhd8ed1ab_0        conda-forge
  pyjwt                       2.10.1               pyhd8ed1ab_0        conda-forge
  pynacl                      1.5.0                py312h024a12e_4     conda-forge
  pysocks                     1.7.1                pyha55dd90_7        conda-forge
  python                      3.12.10              hc22306f_0_cpython  conda-forge
  python-dateutil             2.9.0.post0          pyhff2d567_1        conda-forge
  python-libarchive-c         5.2                  pyh29332c3_0        conda-forge
  python_abi                  3.12                 7_cp312             conda-forge
  pytz                        2025.2               pyhd8ed1ab_0        conda-forge
  pyyaml                      6.0.2                py312h998013c_2     conda-forge
  rattler-build               0.40.0               h8dba533_0          conda-forge
  rattler-build-conda-compat  1.4.3                pyhd8ed1ab_0        conda-forge
  readline                    8.2                  h1d1bf99_2          conda-forge
  referencing                 0.36.2               pyh29332c3_0        conda-forge
  reproc                      14.2.5.post0         h5505292_0          conda-forge
  reproc-cpp                  14.2.5.post0         h286801f_0          conda-forge
  requests                    2.32.3               pyhd8ed1ab_1        conda-forge
  requests-oauthlib           2.0.0                pyhd8ed1ab_1        conda-forge
  rich                        14.0.0               pyh29332c3_0        conda-forge
  ripgrep                     14.1.1               h0ef69ab_0          conda-forge
  rpds-py                     0.24.0               py312hd60eec9_0     conda-forge
  ruamel.yaml                 0.18.10              py312hea69d52_0     conda-forge
  ruamel.yaml.clib            0.2.8                py312h0bf5046_1     conda-forge
  scrypt                      0.8.27               py312ha571a58_0     conda-forge
  setuptools                  79.0.0               pyhff2d567_0        conda-forge
  shellingham                 1.5.4                pyhd8ed1ab_1        conda-forge
  sigtool                     0.1.3                h44b9a77_0          conda-forge
  simdjson                    3.12.3               ha393de7_0          conda-forge
  six                         1.17.0               pyhd8ed1ab_0        conda-forge
  smmap                       5.0.2                pyhd8ed1ab_0        conda-forge
  sniffio                     1.3.1                pyhd8ed1ab_1        conda-forge
  soupsieve                   2.5                  pyhd8ed1ab_1        conda-forge
  spdlog                      1.15.2               h008cadb_0          conda-forge
  tapi                        1300.6.5             h03f4b80_0          conda-forge
  tk                          8.6.13               h5083fa2_1          conda-forge
  tomli                       2.2.1                pyhd8ed1ab_1        conda-forge
  tomli-w                     1.2.0                pyhd8ed1ab_0        conda-forge
  tomlkit                     0.13.2               pyha770c72_1        conda-forge
  toolz                       1.0.0                pyhd8ed1ab_1        conda-forge
  tqdm                        4.67.1               pyhd8ed1ab_1        conda-forge
  trove-classifiers           2025.4.11.15         pyhd8ed1ab_0        conda-forge
  truststore                  0.10.1               pyh29332c3_0        conda-forge
  typer                       0.15.2               pyhff008b6_0        conda-forge
  typer-slim                  0.15.2               pyh29332c3_0        conda-forge
  typer-slim-standard         0.15.2               h801b22e_0          conda-forge
  typing-extensions           4.13.2               h0e9735f_0          conda-forge
  typing_extensions           4.13.2               pyh29332c3_0        conda-forge
  tzdata                      2025b                h78e105d_0          conda-forge
  urllib3                     2.4.0                pyhd8ed1ab_0        conda-forge
  userpath                    1.9.2                pyhd8ed1ab_0        conda-forge
  uv                          0.6.16               h668ec48_0          conda-forge
  virtualenv                  20.30.0              pyhd8ed1ab_0        conda-forge
  vsts-python-api             0.1.25               pyhd8ed1ab_2        conda-forge
  wheel                       0.45.1               pyhd8ed1ab_1        conda-forge
  wrapt                       1.17.2               py312hea69d52_0     conda-forge
  yaml                        0.2.5                h3422bc3_2          conda-forge
  yaml-cpp                    0.8.0                h13dd4ca_0          conda-forge
  zipp                        3.21.0               pyhd8ed1ab_1        conda-forge
  zstandard                   0.23.0               py312hea69d52_1     conda-forge
  zstd                        1.5.7                h6491c7d_2          conda-forge

Additional Context

No response

@ndevenish ndevenish added the type::bug describes erroneous operation, use severity::* to classify the type label Apr 24, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in 🧭 Planning Apr 24, 2025
@ndevenish
Copy link
Author

An extra note that although 74dc428 warns explicitly against using jinja in the output list, the same problem happened even when I completely stripped out the jinja parts of the output names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type::bug describes erroneous operation, use severity::* to classify the type
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

1 participant