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
What happened?
Virtual environment created by
rules_py
does not havesetuptools
installed in it. While it's not guaranteed it's always available, inrules_python
'spy_binary
you canimport pkg_resurces
and inrules_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
orMODULE.bazel
file:0.7.4
Language(s) and/or frameworks involved: None
How to reproduce
Any other information?
Same test passes with
rules_python
: seebazel test //setuptools_not_present_in_venv:ray_rp_test