Skip to content

experimental_target_platforms produces whl with duplicated dependencies #1873

@wingsofovnia

Description

@wingsofovnia

🐞 bug report

Affected Rule

The issue is caused by the rule:

pip.parse

Is this a regression?

Can't test. The reproduction doesn't build on older versions due to #1810

Description

When experimental_target_platforms is used, some whl targets generated have duplicated dependencies, e.g.:

filegroup(
    name = "whl",
    srcs = ["opencv_python-4.8.1.78-cp37-abi3-macosx_11_0_arm64.whl"],
    data = ["@pip//numpy:whl"] + select(
        {
            "@@platforms//os:osx": ["@pip//numpy:whl"],
            "//conditions:default": [],
        },
    ),
    visibility = ["//visibility:public"],
)

🔬 Minimal Reproduction

https://github.com/wingsofovnia/rules_python-issues-1873

Lock files generated via bazel run //:requirements_lock.update:

  • requirements.txt.darwin_aarch64.lock generated on Mac M1
  • requirements.txt.linux_x86_32.lock generated in docker run --platform linux/amd64 container

🔥 Exception or Error

ERROR: /private/var/tmp/.../rules_python~~pip~pip_310_opencv_python/BUILD.bazel:16:10: 
   in data attribute of filegroup rule @@rules_python~~pip~pip_310_opencv_python//:whl: 
      Label '@@rules_python~~pip~pip//numpy:whl' is duplicated

🌍 Your Environment

Operating System:

> uname -a # requirements.txt.darwin_aarch64.lock
Darwin CDDEBERMC005031 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
> uname -a # requirements.txt.linux_x86_32.lock
Linux f74bbe09936a 6.6.22-linuxkit #1 SMP Fri Mar 29 12:21:27 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Output of bazel version:

bazel version
Bazelisk version: v1.19.0
Build label: 7.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Mar 21 18:08:37 2024 (1711044517)
Build timestamp: 1711044517
Build timestamp as int: 1711044517

Rules_python version:

HEAD (d3cec48e415dd598a773335532cbc5647c985a93)

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