Skip to content

Bug in metadata.py : select_lines (Error: Invalid selector in meta.yaml) #4654

Closed as not planned

Description

Checklist

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

What happened?

I'm creating a conda package using conda_nbdev from nbdev.
One of its peculiarities is that it dumps the contents of README.md as the about.description field in meta.yaml. It does so using yaml.safe_dump(). In my case, the output appears to be valid YAML, but conda-build fails to parse it. I've narrowed it down to this minimal test-case:

package:
  name: lovely-tensors
  version: 0.1.8
about:
  description: "# Make our values fit into that range to avoid clipping.\nmean = torch.tensor(in_stats[0])[:,None,None]"

I think it's the combination of # , \n, and : that confuses select_lines:

    for i, line in enumerate(data.splitlines()):
        line = line.rstrip()

        trailing_quote = ""
        if line and line[-1] in ("'", '"'):
            trailing_quote = line[-1]

        if line.lstrip().startswith("#"):
            # Don't bother with comment only lines
            continue

The error I'm getting:

$ conda build --output-folder out --no-anaconda-upload  lovely-tensors
No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.16
WARNING:conda_build.metadata:No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.16
Error: Invalid selector in meta.yaml line 5:
offending line:
  description: "# Make our values fit into that range to avoid clipping.\nmean = torch.tensor(in_stats[0])[:,None,None]"
exception:
invalid syntax (<string>, line 1)

Can't put any more time into this issue, hope someone can pick up the debugging process from here.

Conda Info

active environment : torch
    active env location : /home/xl0/mambaforge/envs/torch
            shell level : 2
       user config file : /home/xl0/.condarc
 populated config files : /home/xl0/mambaforge/.condarc
                          /home/xl0/.condarc
          conda version : 4.14.0
    conda-build version : not installed
         python version : 3.10.6.final.0
       virtual packages : __cuda=11.6=0
                          __linux=5.15.0=0
                          __glibc=2.35=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/xl0/mambaforge  (writable)
      conda av data dir : /home/xl0/mambaforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/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
          package cache : /home/xl0/mambaforge/pkgs
                          /home/xl0/.conda/pkgs
       envs directories : /home/xl0/mambaforge/envs
                          /home/xl0/.conda/envs
               platform : linux-64
             user-agent : conda/4.14.0 requests/2.28.1 CPython/3.10.6 Linux/5.15.0-53-generic ubuntu/22.04.1 glibc/2.35
                UID:GID : 1000:1000
             netrc file : /home/xl0/.netrc
           offline mode : False

Conda Config

channels:
  - conda-forge

==> /home/xl0/.condarc <==
channels:
  - conda-forge
  - defaults

Conda list

No response

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    good first issuegreat for new contributors, code change is envisioned to be trivial/relatively straight-forwardlocked[bot] locked due to inactivitysource::communitycatch-all for issues filed by community membersstale[bot] marked as stale due to inactivitystale::closed[bot] closed after being marked as staletype::bugdescribes erroneous operation, use severity::* to classify the type

    Type

    No type

    Projects

    • Status

      🏁 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions