-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 failure when running tests #539
Comments
You'll need some of the flags used in our travis tests here: https://github.com/tensorflow/probability/blob/master/testing/run_tests.sh#L108 Specifically, i think you'll need
give those a try and let us know if that doesn't fix it. |
Almost missed your answer because it was so fast :p Thanks for the direction trying,
Now gives me a different error,
which feels odd given update: I guess the name of |
Gave it another go just now with the suggested flags after a bazel clean, still seeing the same symptom of internal Closest thing I've found to be related to this issue is from an external repo: RobotLocomotion/drake#8041. However, as mentioned before, I have a very limited knowledge of bazel so I don't know if this is still relevant in the recent bazel versions. |
Since you're running py3.6, you may not need
the --noincompatible_py3_is_default
Brian Patton | Software Engineer | [email protected]
…On Sun, Sep 1, 2019 at 6:43 PM Shrdlu ***@***.***> wrote:
Gave it another go just now with the suggested flags after a bazel clean,
still seeing the same symptom of internal math module shadowing the
python standard math.
Closest thing I've found to be related to this issue is from an external
repo: RobotLocomotion/drake#8041
<RobotLocomotion/drake#8041>. However, as
mentioned before, I have a very limited knowledge of bazel so I don't know
if this is still relevant in the recent bazel versions.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#539?email_source=notifications&email_token=AFJFSI2FAB4KO43P2BTFXOLQHRAQJA5CNFSM4ISVYZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UMIHQ#issuecomment-526959646>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFJFSI2GP3ZU2KSJSQ2D7ZDQHRAQJANCNFSM4ISVYZAA>
.
|
Thanks for the suggestion, but taking the flag out brought me back to the shadowing issue.
I tried the |
I just tried the following from the master branch:
VENV=$(mktemp -d)
virtualenv -p python3.6 $VENV
source $VENV/bin/activate
pip install tf-nightly cloudpickle hypothesis numpy mock scipy decorator
matplotlib
bazel test --compilation_mode=opt --copt=-O3 --copt=-march=native
--test_tag_filters=-gpu,-requires-gpu-sm35,-notap,-no-oss-ci,-tfp_jax
--action_env=PATH //tensorflow_probability/... --test_output=errors
which seems to be working
Maybe remove the =... part from your --action_env=PATH arg?
Brian Patton | Software Engineer | [email protected]
…On Tue, Sep 3, 2019 at 3:52 PM Shrdlu ***@***.***> wrote:
Thanks for the suggestion, but taking the flag out brought me back to the
shadowing issue.
update: I guess the name of noincompatible_py3_is_default confused me so I
turned it off. Just back to the same error. I'll check the other flags
later.
I tried the action_env flag in various ways, if I run with
--action_env=PATH then it just shows the shadowing behavior I described.
If I point the argument to my virtual env bin i.e.
bazel test --compilation_mode=opt --copt=-O3 --copt=-march=native --test_tag_filters=-gpu,-requires-gpu-sm35,-notap,-no-oss-ci,-tfp_jax --action_env=PATH=/home/dvorak/Workspace/tf/bin //tensorflow_probability/...
results in
ERROR: /home/dvorak/Workspace/probability/tensorflow_probability/python/experimental/substrates/numpy/bijectors/BUILD:91:2: Executing genrule //tensorflow_probability/python/experimental/substrates/numpy/bijectors:rewrite_reciprocal failed (Exit 1) bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
Error occurred while attempting to use the default Python toolchain ***@***.***_tools//tools/python:autodetecting_toolchain).
Neither 'python3' nor 'python' were found on the target platform's PATH, which is:
/home/dvorak/Workspace/tf/bin
Please ensure an interpreter is available on this platform (and marked executable), or else register an appropriate Python toolchain as per the documentation for py_runtime_pair (https://github.com/bazelbuild/bazel/blob/master/tools/python/toolchain.bzl).
which is weird given that python bins should be available there, but I
feel like I shouldn't be fiddling around with the path argument given that
my test runs on correct version of python without modifying it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#539?email_source=notifications&email_token=AFJFSI3SNW7I2HBECSRLNJ3QH26BDA5CNFSM4ISVYZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5ZLUQQ#issuecomment-527612482>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFJFSI2OSEIVRQLK7CARK53QH26BDANCNFSM4ISVYZAA>
.
|
I tried setting up a fresh virtualenv again according to
Running following command at master of venv
results in
So back to the same error. Is there any other log or setting info that I could provide to demystify this? |
Does --action_env=LD_LIBRARY_PATH help at all? (I'm not sure whether it's
relevant, but could be since TF has c++ code.)
Can you put a print(sys.path) into the top of tensorflow_
probability/tensorflow_probability/python/experimental/substrates/numpy/rewrite.py,
even before imports?
Maybe we're missing a from __future__ import absolute_import somewhere in a
__init__.py.
Brian Patton | Software Engineer | [email protected]
…On Wed, Sep 4, 2019 at 5:04 PM Shrdlu ***@***.***> wrote:
I tried setting up a fresh virtualenv again according to
VENV=$(mktemp -d)
virtualenv -p python3.6 $VENV
source $VENV/bin/activate
pip install tf-nightly cloudpickle hypothesis numpy mock scipy decorator matplotlib
Running following command at master of venv
(tmp.ir3OWSdj5I) ***@***.*** probability]$ bazel test --compilation_mode=opt --copt=-O3 --copt=-march=native --test_tag_filters=-gpu,-requires-gpu-sm35,-notap,-no-oss-ci,-tfp_jax --action_env=PATH //tensorflow_probability/... --test_output=errors
results in
ERROR: /home/dvorak/Workspace/probability/tensorflow_probability/python/experimental/substrates/jax/bijectors/BUILD:93:2: Executing genrule //tensorflow_probability/python/experimental/substrates/jax/bijectors:rewrite_identity failed (Exit 1) bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
Traceback (most recent call last):
File "/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/171/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles/tensorflow_probability/tensorflow_probability/python/experimental/substrates/numpy/rewrite.py", line 24, in <module>
from absl import app
File "/tmp/tmp.ir3OWSdj5I/lib/python3.6/site-packages/absl/app.py", line 41, in <module>
from absl import logging
File "/tmp/tmp.ir3OWSdj5I/lib/python3.6/site-packages/absl/logging/__init__.py", line 83, in <module>
import socket
File "/usr/lib64/python3.6/socket.py", line 52, in <module>
import os, sys, io, selectors
File "/usr/lib64/python3.6/selectors.py", line 10, in <module>
import math
File "/home/dvorak/Workspace/probability/tensorflow_probability/python/experimental/substrates/numpy/math/__init__.py", line 22, in <module>
from tensorflow_probability.python.experimental.substrates.numpy.math.generic import log_add_exp
ModuleNotFoundError: No module named 'tensorflow_probability.python.experimental.substrates.numpy.math'
INFO: Elapsed time: 21.475s, Critical Path: 6.38s
INFO: 48 processes: 48 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
So back to the same error. Is there any other log or setting info that I
could provide to demystify this?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#539?email_source=notifications&email_token=AFJFSIZO6THQRDLBO4LM6X3QIAPEXA5CNFSM4ISVYZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD547KJY#issuecomment-528086311>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFJFSIYVAOFUFCQKVITFIETQIAPEXANCNFSM4ISVYZAA>
.
|
Yeah I tried On The import lines go as following:
I tried injecting (right before
|
That's tricky, you're right about the shadowing: selectors.py trying to
import from this package makes no sense otherwise. I will look more closely
tomorrow, I think we've seen this before on Travis but don't remember how
we resolved.
…On Wed, Sep 4, 2019, 5:55 PM Shrdlu ***@***.***> wrote:
Yeah I tried LD_LIBRARY_PATH but not much luck.
On
tensorflow_probability/tensorflow_probability/python/experimental/substrates/numpy/rewrite.py
The import lines go as following:
"""Rewrite script for TF->JAX."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
# Dependency imports
from absl import app
from absl import flags
I tried injecting and looking at sys.path output during build, it yielded
['/home/dvorak/Workspace/probability/tensorflow_probability/python/experimental/substrates/numpy', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles/tensorflow_probability', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles/bazel_tools', '/tmp/tmp.ir3OWSdj5I/lib/python36.zip', '/tmp/tmp.ir3OWSdj5I/lib/python3.6', '/tmp/tmp.ir3OWSdj5I/lib/python3.6/lib-dynload', '/usr/lib64/python3.6', '/usr/lib/python3.6', '/tmp/tmp.ir3OWSdj5I/lib/python3.6/site-packages']
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#539?email_source=notifications&email_token=AFJFSI5C6HMXPJTPQLFEXFTQIAVF3A5CNFSM4ISVYZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD55DYTA#issuecomment-528104524>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFJFSI5VTPNR7ZXQ7RZ7Z7DQIAVF3ANCNFSM4ISVYZAA>
.
|
http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap
seems to diagnose this. Particularly:
There’s a reason the general “no package directories on sys.path” guideline
exists, and the fact that the interpreter itself doesn’t follow it when
determining sys.path[0] is the root cause of all sorts of grief.
We could maybe address this by putting a 'cd / &&' at the front of the
genrule cmd in the corresponding BUILD file.
…On Wed, Sep 4, 2019, 9:12 PM Brian Patton 🚀 ***@***.***> wrote:
That's tricky, you're right about the shadowing: selectors.py trying to
import from this package makes no sense otherwise. I will look more closely
tomorrow, I think we've seen this before on Travis but don't remember how
we resolved.
On Wed, Sep 4, 2019, 5:55 PM Shrdlu ***@***.***> wrote:
> Yeah I tried LD_LIBRARY_PATH but not much luck.
>
> On
> tensorflow_probability/tensorflow_probability/python/experimental/substrates/numpy/rewrite.py
>
> The import lines go as following:
>
> """Rewrite script for TF->JAX."""
> from __future__ import absolute_import
> from __future__ import division
> from __future__ import print_function
>
> import collections
>
> # Dependency imports
> from absl import app
> from absl import flags
>
> I tried injecting and looking at sys.path output during build, it yielded
>
> ['/home/dvorak/Workspace/probability/tensorflow_probability/python/experimental/substrates/numpy', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles/tensorflow_probability', '/home/dvorak/.cache/bazel/_bazel_dvorak/4f8040e5b73e034f489a3157c8a93f87/sandbox/processwrapper-sandbox/233/execroot/tensorflow_probability/bazel-out/host/bin/tensorflow_probability/python/experimental/substrates/numpy/rewrite.runfiles/bazel_tools', '/tmp/tmp.ir3OWSdj5I/lib/python36.zip', '/tmp/tmp.ir3OWSdj5I/lib/python3.6', '/tmp/tmp.ir3OWSdj5I/lib/python3.6/lib-dynload', '/usr/lib64/python3.6', '/usr/lib/python3.6', '/tmp/tmp.ir3OWSdj5I/lib/python3.6/site-packages']
>
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#539?email_source=notifications&email_token=AFJFSI5C6HMXPJTPQLFEXFTQIAVF3A5CNFSM4ISVYZAKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD55DYTA#issuecomment-528104524>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFJFSI5VTPNR7ZXQ7RZ7Z7DQIAVF3ANCNFSM4ISVYZAA>
> .
>
|
Hm, I don't see any genrule in Not sure how I can chain the Edit: Looking at the error log again, I guess I should have looked at Edit 2: Changing
to
yields
So uh, I guess I should try to apply |
Quoting http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap: """ There?s a reason the general ?no package directories on sys.path? guideline exists, and the fact that the interpreter itself doesn?t follow it when determining sys.path[0] is the root cause of all sorts of grief. """ Also relevant: bazelbuild/bazel#7091 This is addressed toward issue #539 PiperOrigin-RevId: 268058051
Hopefully that resolves your issue! Let me know. |
Worked like a charm! Thank you for the help and guidance @brianwa84 @csuter . I learned a lot through this process - about some flags in bazel, and about the quirks in bazel+python sandbox causing shading issue with the import trap. Still a little embarrassed about my obliviousness to bazel and build scripts in this project but you guys made the experience pleasant. I hope to learn more, and contribute in the future. |
Glad you are up and running again. No cause for embarrassment, no one knows it all and we are all learning new things every day :) |
Quoting http://python-notes.curiousefficiency.org/en/latest/python_concepts/import_traps.html#the-double-import-trap: """ There?s a reason the general ?no package directories on sys.path? guideline exists, and the fact that the interpreter itself doesn?t follow it when determining sys.path[0] is the root cause of all sorts of grief. """ Also relevant: bazelbuild/bazel#7091 This is addressed toward issue tensorflow#539 PiperOrigin-RevId: 268058051
Hello!
I am trying to get the recent
master
branch to build & test for an issue I am trying to resolve. I am running on a fresh virtual env with python3.6
, bazel0.28.1
, and pip installation oftf-nightly
on Manjaro Linux18.0.4
.For reference, here's the output for
pip list
Running
Results in
As far as I can tell from the stack trace, it's trying to import
math
from an internal namespace instead of importing the standard pythonmath
module. Unfortunately, this is my first time with bazel so I don't have a clear picture of what can be done to fix the issue.I tried looking up few bazel related issues in the past (i.e. #179 #141 ), but I haven't found them helpful in resolving this issue.
Thank you for taking the time to read this issue.
The text was updated successfully, but these errors were encountered: