Skip to content

whl_filegroup fails when no python3 installed on host  #2087

@froody

Description

@froody

🐞 bug report

Affected Rule

The issue is caused by the rule: whl_filegroup

Is this a regression?

No

Description

The whl_filegroup rule runs a python script, but this script depends on /usr/bin/env python3 which in my case isn't present, even though I've set a default python toolchain.

🔬 Minimal Reproduction

## MODULE.bazel
bazel_dep(name = "rules_python", version = "0.34.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version="3.10", is_default=True, ignore_root_user_error = True)
use_repo(python, "python_3_10")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
    hub_name = "pip_deps",
    python_version = "3.10",
    requirements_lock = "//:requirements.txt",
)
use_repo(pip, "pip_deps")

## BUILD
load("@rules_python//python:pip.bzl", "whl_filegroup")
whl_filegroup(
    name = "numpy_includes",
    pattern = "numpy/core/include/numpy",
    whl = "@pip_deps//numpy:whl",
)

🔥 Exception or Error





15.35 ERROR: /opt/builder/BUILD:57:14: Extracting numpy/core/include/numpy files from ../rules_python~~pip~pip_deps_310_numpy/numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl failed: (Exit 127): extract_wheel_files failed: error executing PyExtractWheelFiles command (from target //:numpy_includes) bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/rules_python~/python/private/whl_filegroup/extract_wheel_files ... (remaining 3 arguments skipped)
15.35 /usr/bin/env: 'python3': No such file or directory

🌍 Your Environment

Operating System:

  
Ubuntu 22.04
  

Output of bazel version:

  
7.2.0
  

Rules_python version:

  
0.34.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    need: reproNeeds a minimal reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions