Skip to content

Explicit pip pin is dropped when pip: dependencies are present #919

Description

@mdunphy

Checklist

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

What happened?

If an environment.yml contains both an explicit conda pin for pip and a pip: subsection, conda-lock replaces the explicit pin with pip * during solving.

Example:

name: test
channels:
  - conda-forge
dependencies:
  - python=3.12.1
  - pip=25.0.1
  - pip:
      - requests

When using conda-lock it loses the 25.0.1 pin:

INFO:conda_lock.conda_solver:linux-64 using specs ['python 3.12.1.*', 'pip *']

If I remove the pip section (last two lines), then it does not lose the pin:

INFO:conda_lock.conda_solver:linux-64 using specs ['python 3.12.1.*', 'pip 25.0.1.*']

This seems like a bug --- if the environment yaml explicitly specifies a conda-side pip constraint, that constraint should be preserved.

Additional Context

For what it's worth, Pixi does not have this issue, it respects the 25.0.1 pin with and without a pip section

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions