-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazel is using user site packages by default #8475
Comments
Filed upstream as bazelbuild/bazel#4939. |
If I'm recalling correctly, #8476 fixed tools (genrules, actions, etc.) that use python, but did not isolate things like unit tests, which still use user site-packages. Now that we have platform-specific bazel rcfiles, I believe we could disable |
Hm... What if we did something like adding But yes, I'm down for whatever can cut that off from affecting unittests. |
Yes, that's essentially what I was proposing. Though we'd need to check if |
FYI I'm prototyping the rcfile changes in Anzu. If we bake that for a while and like it, I'll pull the changes into Drake (Ubuntu only) next. |
We've had this in TRI (Anzu) since March. It seems to be working great: # Disable python imports from ~/.local (pip -U) during build and test.
# https://github.com/bazelbuild/bazel/issues/4939
# https://github.com/RobotLocomotion/drake/issues/8475
build --action_env=PYTHONNOUSERSITE=1
build --test_env=PYTHONNOUSERSITE=1 We should probably add it to our Ubuntu rcfile in Drake. |
Something like
or
is enabled by default when Bazel is running python stuff, which means that
$HOME/.local
can non-hermetically enter the build.This is bad in general, but specifically bad for genrules such as https://github.com/RobotLocomotion/drake/blob/master/tools/workspace/godotengine/main_make_binders.py where we do
import core
and some other thing in.local
was namedcore
, and then poof our genrule fails.Note that this is different than
PYTHONPATH
leaks -- I think we are correctly guarding against PYTHONPATH breaking the hermetic seal. The user site mechanism appears to operate distinctly and outside of the PYTHONPATH mechanisms.More details / fixes to follow as I explore more. This is just a placeholder for now.
The text was updated successfully, but these errors were encountered: