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

Error if using non PEP508 / PEP440 compliant version specifiers in conda-build recipe #176

Closed
wagnerpeer opened this issue Mar 15, 2022 · 0 comments · Fixed by #180
Closed

Comments

@wagnerpeer
Copy link

Hi there

I am using conda-lock for a while now and I am experiencing issues since the update to the new major version.

Issue

If I run conda-lock to create a lockfile based on a conda-build recipe, I can no longer use the full package specification syntax as defined by conda. If I use a specifier, which is not PEP508/PEP440 compliant, but is a valid conda package specification (single =), the process crashes with pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'=3'": Expected stringEnd (see details section)

Environment

conda-lock version: 1.0.2=pyhd8ed1ab_0
python version: 3.8.10
System used: Windows 10 Enterprise 20H2

Details

The issue can be reproduced with a minimal meta.yaml as following:

package:
  name: package
  version: "0.0"

requirements:
  run:
    - python=3

The invocation is equivalent to:
conda lock -p win-64 --file C:Temp\meta.yaml

The issue lies in conda_lock\src_parser\pyproject_toml.py, line 239, in the function parse_python_requirement. It uses pkg_resources.Requirement. As conda does not support the ~= version specifier and is giving a pending deprecation warning if using the asterisk together with the == specifier (e.g. python==3.*), I see no immediate and convenient solution to this problem.

Contrary to the issue while using the build recipe as source, the exact same version specifier used in an environment.yml file is working as expected.

All 1.x.x versions show this behavior, whereas the last prior version 0.13.2 is working as expected.

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

Successfully merging a pull request may close this issue.

1 participant