Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`compile_pip_requirements` fails because setuptools contains file with spaces in name

未关闭
#3,681 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
build-system

调研方向

首先,使用所示的 compile_pip_requirements 配置复现 bazel run //:requirements.update,并检查规则如何处理 setuptools 路径 Lorem ipsum.txt。检查生成的 runfiles 清单和相关的规则入口点。当某个依赖包含带空格的文件名时,requirements 更新目标能够成功构建,即表示完成。

由索引模型根据 Issue 内容生成。

描述

🐞 bug report

Affected Rule

compile_pip_requirements when ran with bazel run //:requirements.update

Is this a regression?

Not sure. Similar issue is #4605.

Description

My BUILD file contains the following -

load("@rules_python//python:pip.bzl", "compile_pip_requirements")
compile_pip_requirements(
    name = "requirements",
    src = "requirements.in",
    requirements_txt = "requirements_lock.txt",
)

The issue seems to be that the file "pypi__setuptools/setuptools/_vendor/jaraco/text/Lorem ipsum.txt" used by setuptools has a space in the name and Bazel won't accept that.

I am using USE_BAZEL_VERSION=7.3.2. With MODULE having -

bazel_dep(name = "rules_python", version = "1.8.5")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    python_version = "3.13",
)

🔬 Minimal Reproduction

bazel run //:requirements.update

🔥 Exception or Error


BUILD.bazel:31:25: Creating runfiles tree bazel-out/k8-fastbuild/bin/requirements.update.runfiles failed: build-runfiles failed: error executing  command 

  (cd /home/rishin/.cache/bazel/_bazel_rishin/a5698ab7503342d8072bd8e495f01f91/execroot/_main && \

  exec env - \

    PATH=/home/rishin/.cache/bazelisk/downloads/sha256/96e9c34caf77b25a2fe1f0699cb85d23226a7a9f563ac156f0ed2033402b080b/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin \

  /home/rishin/.cache/bazel/_bazel_rishin/install/aeea4605fbb10c56d04772b8e314db75/build-runfiles --allow_relative bazel-out/k8-fastbuild/bin/requirements.update.runfiles_manifest bazel-out/k8-fastbuild/bin/requirements.update.runfiles): Process exited with status 1: Process exited with status 1

/home/rishin/.cache/bazel/_bazel_rishin/install/aeea4605fbb10c56d04772b8e314db75/build-runfiles (args bazel-out/k8-fastbuild/bin/requirements.update.runfiles_manifest bazel-out/k8-fastbuild/bin/requirements.update.runfiles): link or target filename contains space on line 937: '_main/external/rules_python~~config~pypi__setuptools/setuptools/_vendor/jaraco/text/Lorem ipsum.txt /home/rishin/.cache/bazel/_bazel_rishin/a5698ab7503342d8072bd8e495f01f91/external/rules_python~~config~pypi__setuptools/setuptools/_vendor/jaraco/text/Lorem ipsum.txt'
Target //:requirements.update failed to build 

🌍 Your Environment

Operating System: 11.8.5

Output of bazel version:

  
Bazelisk version: v1.27.0
Starting local Bazel server and connecting to it...
Build label: 7.3.2
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Tue Oct 1 17:46:05 2024 (1727804765)
Build timestamp: 1727804765
Build timestamp as int: 1727804765
  

Rules_python version: 1.8.5

主要语言
Starlark
星标
690
派生
722
平均合并
1 天 55 分钟
30 天内合并 PR
38

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bazel-contrib/rules_python 的其他 Issue

查看 bazel-contrib/rules_python 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。