Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pip.parse doesn't fetch anything with conflicting markers #2337

Copy link
Copy link
Closed
@keith

Description

@keith
Issue body actions

If I have a requirements.in like this:

--extra-index-url https://download.pytorch.org/whl/cpu
torch==2.4.1; platform_machine != "x86_64"
torch==2.4.1+cpu; platform_machine == "x86_64"

Which I use to generate a universal requirements.txt with uv using: uv pip compile --universal requirements.in -o requirements_lock.txt --emit-index-url --no-strip-markers, I end up with multiple entries for torch in that lockfile:

SNIP
torch==2.4.1+cpu ; platform_machine == 'x86_64'
    # via -r requirements.in
torch==2.4.1 ; platform_machine != 'x86_64'
    # via -r requirements.in
SNIP

When I attempt to pull those in with:

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    hub_name = "pip",
    python_version = "3.11",
    requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pip")

and use them with:

load("@pip//:requirements.bzl", "requirement")

alias(
    name = "foo",
    actual = requirement("torch"),
)

It fails with:

ERROR: no such package '@@rules_python~~pip~pip//torch': BUILD file not found in directory 'torch' of external repository @@rules_python~~pip~pip. Add a BUILD file to a directory to mark it as a package.
ERROR: /tmp/pyrepro/BUILD.bazel:3:6: no such package '@@rules_python~~pip~pip//torch': BUILD file not found in directory 'torch' of external repository @@rules_python~~pip~pip. Add a BUILD file to a directory to mark it as a package. and referenced by '//:foo'

If I remove the non-matching entry from the lockfile it works, so I assume it's the nature of having 2 conflicting requirements even though they are disambiguated by the marker.

To repro in this project: repro.zip

Run bazel fetch ...

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.