Skip to content
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 run adds $PYTHONPATH to paths while bazel test does not #2867

Closed
jamessha opened this issue Apr 23, 2017 · 3 comments
Closed

bazel run adds $PYTHONPATH to paths while bazel test does not #2867

jamessha opened this issue Apr 23, 2017 · 3 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Python Native rules for Python type: bug

Comments

@jamessha
Copy link

jamessha commented Apr 23, 2017

echo $PYTHONPATH
-> /usr/lib/spark/python:/usr/lib/spark/python/build:/usr/lib/spark/python/lib/py4j-0.10.4-src.zip

bazel test --spawn_strategy=standalone --test_output=errors --force_python=PY3 --host_force_python=PY3 //src/model:utils_test
-> print(sys.path) yields
['/home/ubuntu/mono/src/model', '/home/ubuntu/.cache/bazel/_bazel_ubuntu/a668d06d6b766d20e5a2cc9d6a3f6fb6/execroot/mono/bazel-out/local-py3-fastbuild/bin/src/model/utils_test.runfiles', '/home/ubuntu/.cache/bazel/_bazel_ubuntu/a668d06d6b766d20e5a2cc9d6a3f6fb6/execroot/mono/bazel-out/local-py3-fastbuild/bin/src/model/utils_test.runfiles/pavlov', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/python3.5/dist-packages/setuptools-33.1.1-py3.5.egg', '/usr/lib/python3/dist-packages']

bazel run --spawn_strategy=standalone --test_output=errors --force_python=PY3 --host_force_python=PY3 //src/model:utils_test
-> print(sys.path) yields
['/home/ubuntu/mono/src/model', '/home/ubuntu/.cache/bazel/_bazel_ubuntu/a668d06d6b766d20e5a2cc9d6a3f6fb6/execroot/mono/bazel-out/local-py3-fastbuild/bin/src/model/utils_test.runfiles', '/home/ubuntu/.cache/bazel/_bazel_ubuntu/a668d06d6b766d20e5a2cc9d6a3f6fb6/execroot/mono/bazel-out/local-py3-fastbuild/bin/src/model/utils_test.runfiles/pavlov', '/usr/lib/spark/python', '/usr/lib/spark/python/build', '/usr/lib/spark/python/lib/py4j-0.10.4-src.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5/dist-packages', '/usr/local/lib/python3.5/dist-packages/setuptools-33.1.1-py3.5.egg', '/usr/lib/python3/dist-packages']

#753 seemed to imply that running tests in standalone should allow pythonpath to filter through but this doesn't seem to be the case.

Environment info

  • Operating System:
    ubuntu 14.04

  • Bazel version (output of bazel info release):
    release 0.4.5

@jamessha jamessha changed the title bazel run adds $PYTHONPATH to runtime paths while bazel test does not bazel run adds $PYTHONPATH to paths while bazel test does not Apr 23, 2017
@vladmos vladmos added category: rules > python P2 We'll consider working on this in future. (Assignee optional) type: bug labels Apr 24, 2017
@excavador
Copy link

excavador commented Jan 4, 2018

➜ bazel version
Build label: 0.9.0-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Sun Jul 12 12:24:01 +49936 (1513677414241)
Build timestamp: 1513677414241
Build timestamp as int: 1513677414241

Sometime bazel server insert incorrect PATH (on bazel test, on bazel run everything is fine)

Pathes from "bazel test -s //..." on two different machines (everything is same - bazel version, source code)

PATH=/usr/bin:/bin:/usr/sbin:/sbin # incorrect PATH, does not reflect system PATH
PATH=/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin # correct PATH

"bazel clean" does not help, "bazel clean --expunge" helps.
Probably, bazel shutdown will help.

@excavador
Copy link

#753

@brandjon brandjon added P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-Python Native rules for Python and removed P2 We'll consider working on this in future. (Assignee optional) category: rules > python labels Oct 19, 2018
@sgowroji sgowroji added the stale Issues or PRs that are stale (no activity for 30 days) label Feb 3, 2023
@sgowroji
Copy link
Member

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Python Native rules for Python type: bug
Projects
None yet
Development

No branches or pull requests

5 participants