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

Usage of a != version specifier causes a parsing exception #297

Open
gforsyth opened this issue Jan 27, 2025 · 1 comment
Open

Usage of a != version specifier causes a parsing exception #297

gforsyth opened this issue Jan 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@gforsyth
Copy link

What happened?

A recipe that uses a != comparison to filter a version causes an Exception:

EXCEPTION: An exception occurred while parsing the recipe file
while parsing a flow mapping
  in "<unicode string>", line 1, column 4
did not find expected ',' or '}'
  in "<unicode string>", line 1, column 24
0 errors and 0 warnings were found.

The diff below is a workaround for the same behavior:

@@ -79,7 +79,7 @@ outputs:
       string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
       ignore_run_exports_from:
         - {{ compiler('cuda') }}
-        - {{ "cuda-cudart-dev" if cuda_major != "11" else "cuda-version" }}
+        - {{ "cuda-cudart-dev" if not (cuda_major == "11") else "cuda-version" }}
     requirements:
       build:
         - cmake {{ cmake_version }}

To Reproduce

Steps to reproduce the behavior:

I've pasted a recipe below that has a != -- changing it as per the diff above allows the recipe converter to complete.

# Copyright (c) 2018-2025, NVIDIA CORPORATION.

{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') %}
{% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %}
{% set cuda_major = cuda_version.split('.')[0] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}

package:
  name: librmm-split

source:
  path: ../../..

requirements:
  build:
    - cmake {{ cmake_version }}
    - ninja
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - {{ compiler('cuda') }} {{ cuda_version }} if cuda_major == "11" else compiler('cuda') }}
    - cuda-version ={{ cuda_version }}
    - {{ stdlib("c") }}
  host:
    - cuda-version ={{ cuda_version }}
    - fmt {{ fmt_version }}
    - spdlog {{ spdlog_version }}

build:
  script_env:
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - AWS_SESSION_TOKEN
    - CMAKE_C_COMPILER_LAUNCHER
    - CMAKE_CUDA_COMPILER_LAUNCHER
    - CMAKE_CXX_COMPILER_LAUNCHER
    - CMAKE_GENERATOR
    - PARALLEL_LEVEL
    - SCCACHE_BUCKET
    - SCCACHE_IDLE_TIMEOUT
    - SCCACHE_REGION
    - SCCACHE_S3_KEY_PREFIX=librmm-aarch64 # [aarch64]
    - SCCACHE_S3_KEY_PREFIX=librmm-linux64 # [linux64]
    - SCCACHE_S3_USE_SSL
    - SCCACHE_S3_NO_CREDENTIALS

outputs:
  - name: librmm
    version: {{ version }}
    script: install_librmm.sh
    build:
      number: {{ GIT_DESCRIBE_NUMBER }}
      string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
      run_exports:
        - {{ pin_subpackage("librmm", max_pin="x.x") }}
      ignore_run_exports_from:
        - {{ compiler('cuda') }}
    requirements:
      build:
        - cmake {{ cmake_version }}
      host:
        - cuda-version ={{ cuda_version }}
      run:
        - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
        - {{ "cudatoolkit" if cuda_major == "11" else "cuda-version" }}
        - fmt {{ fmt_version }}
        - spdlog {{ spdlog_version }}
    test:
      commands:
        - test -d "${PREFIX}/include/rmm"
    about:
      home: https://rapids.ai/
      license: Apache-2.0
      summary: librmm library
  - name: librmm-tests
    version: {{ version }}
    script: install_librmm_tests.sh
    build:
      number: {{ GIT_DESCRIBE_NUMBER }}
      string: cuda{{ cuda_major }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
      ignore_run_exports_from:
        - {{ compiler('cuda') }}
        - {{ "cuda-cudart-dev" if cuda_major != "11" else "cuda-version" }}
    requirements:
      build:
        - cmake {{ cmake_version }}
      host:
        - cuda-version ={{ cuda_version }}
        - {{ "cudatoolkit" if cuda_major == "11" else "cuda-cudart-dev" }}
      run:
        - {{ "cudatoolkit" if cuda_major == "11" else "cuda-cudart" }}
        - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
        - {{ pin_subpackage('librmm', exact=True) }}
    about:
      home: https://rapids.ai/
      license: Apache-2.0
      summary: librmm test & benchmark executables

Additional Details (please complete the following information):

  • OS: Linux, Ubuntu 24.04
  • Conda Recipe Manager version: 0.4.1
  • Any other context about the problem that was found.
@gforsyth gforsyth added bug Something isn't working to sort Needs additional investigation labels Jan 27, 2025
@schuylermartin45
Copy link
Collaborator

schuylermartin45 commented Jan 27, 2025

Support for these in-line ternary statements is very new, so I'm glad you reported this. The ! likely breaks the nasty regex used to handle these ternary JINJA statements.

#285 Tracks full "support" for this logic by the parser, but I doubt we'll add it at this point.

@schuylermartin45 schuylermartin45 removed the to sort Needs additional investigation label Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Ready
Development

No branches or pull requests

2 participants