bazel-contrib / bazel-contrib/rules_python

Missing files when running with `venvs_site_packages=yes`

オープン
#3,470 コメント 13 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Starlark
スター
688
フォーク
721
平均マージ
15時間 7分
マージ済み PR(30日)
76

説明

When I try to run `bazel build @rules_python//python/config_settings:venvs_site_packages=yes //...` I see the following output from one of my internal usages of `py_wheel`:

```
INFO: Invocation ID: 45e6114d-6e00-443c-95d4-ae1757315abd
ERROR: /Users/frank/workspace/yobi/data-alt-2/tools/runnable/examples/python/BUILD:10:17: Building wheel @@//tools/runnable/examples/python:example_app_deploy_wheel failed: (Exit 1): sandbox-exec failed: error executing PyWheel command
(cd /private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main && \
exec env - \
PATH=/bin:/usr/bin:/usr/local/bin \
TMPDIR=/var/folders/kb/_rxq15gs3gq21765gfcbbdjw0000gn/T/ \
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/sandbox.sb /var/tmp/_bazel_fp/install/f96a4af1851d4fb5dafa59d311169545/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/stats.out' bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker --name example_app --version 0 --python_tag py3 --abi none --platform any --out bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/example_app-0-py3-none-any.whl --name_file bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/example_app_deploy_wheel.name --input_file_list bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/example_app_deploy_wheel_target_wrapped_inputs.txt --metadata_file bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/example_app_deploy_wheel.metadata.txt --entry_points_file bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/example_app_deploy_wheel_entry_points.txt)
Traceback (most recent call last):
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/_main/../rules_python+/tools/_wheelmaker_stage2_bootstrap.py", line 506, in
main()
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/_main/../rules_python+/tools/_wheelmaker_stage2_bootstrap.py", line 500, in main
_run_py_path(main_filename, args=sys.argv[1:])
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/_main/../rules_python+/tools/_wheelmaker_stage2_bootstrap.py", line 287, in _run_py_path
runpy.run_path(main_filename, run_name="__main__")
File "", line 286, in run_path
File "", line 98, in _run_module_code
File "", line 88, in _run_code
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/rules_python+/tools/wheelmaker.py", line 660, in
main()
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/rules_python+/tools/wheelmaker.py", line 560, in main
maker.add_file(package_filename, real_filename)
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/rules_python+/tools/wheelmaker.py", line 323, in add_file
self._whlfile.add_file(package_filename, real_filename)
File "/private/var/tmp/_bazel_fp/01684213bb9c693047272ec8f0247481/sandbox/darwin-sandbox/5853/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_python+/tools/wheelmaker.runfiles/rules_python+/tools/wheelmaker.py", line 173, in add_file
with open(real_filename, "rb") as fsrc:
^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'bazel-out/darwin_arm64-fastbuild/bin/tools/runnable/examples/python/_example_app_bin.venv/lib/python3.12/site-packages/attr'
INFO: Elapsed time: 2.497s, Critical Path: 2.02s
INFO: 79 processes: 53 action cache hit, 79 internal.
ERROR: Build did NOT complete successfully
```

I am still investigating whether this is user error and whether I may have been doing something "unofficial" without declaring formal runfiles deps, but wanted to post this early since I know there is a lot of ongoing work for this feature.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、`bazel build @rules_python//python/config_settings:venvs_site_packages=yes //...` コマンドを再現し、`py_wheel` アクションの入力を調べます。`tools/wheelmaker.py` と、失敗している `add_file` 呼び出し付近の `wheelmaker` エントリーポイントを読み、生成された `_example_app_bin.venv/lib/python3.12/site-packages/attr` パスが存在しない理由を特定します。`venvs_site_packages=yes` で wheel のビルドが成功し、期待されるファイルが含まれれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
build-system
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。