aspect-build / rules_py

More compatible Bazel rules for running Python tools and building Python projects
Apache License 2.0
86 stars 28 forks source link

[Bug]: `setuptools` is not present in venv #376

Closed dizzy57 closed 3 months ago

dizzy57 commented 3 months ago

What happened?

Virtual environment created by rules_py does not have setuptools installed in it. While it's not guaranteed it's always available, in rules_python's py_binary you can import pkg_resurces and in rules_py it fails.

Version

Development (host) and target OS/architectures: macOS aarch64, also reproduced on Linux x86_64

Output of bazel --version: bazel 7.2.1

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file: 0.7.4

Language(s) and/or frameworks involved: None

How to reproduce

git clone https://github.com/dizzy57/bazel_py_minimal
cd bazel_py_minimal
bazel test //setuptools_not_present_in_venv/...

Expected result: all tests pass
Actual result: //setuptools_not_present_in_venv:ray_test fails with a message
ModuleNotFoundError: No module named 'pkg_resources'

Any other information?

Same test passes with rules_python: see bazel test //setuptools_not_present_in_venv:ray_rp_test

mattem commented 3 months ago

Closing as discussed on Slack. See this comment for further details.