-
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
numpy: Require NumPy >= 0.15.0 #8608
numpy: Require NumPy >= 0.15.0 #8608
Conversation
+@jamiesnape for feature review, please, if you have time. Review status: 0 of 12 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, all discussions resolved. a discussion (no related file): Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, 1 unresolved discussion. a discussion (no related file): Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, 2 unresolved discussions. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I agree with Jeremy, we should not merge until the numpy PR has been accepted. Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, 2 unresolved discussions. a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
I just don't agree with all these "experimental" caveats and allowing other versions (as I don't agree with #8163 either) . If we are going to do this it should be the one true way and we should not clutter the language or code with the extra complications. We are writing and testing a production quality system here. tools/workspace/numpy/repository.bzl, line 24 at r1 (raw file):
We are only going to test one version, so I do not think we should be allowing any other version whatsoever, hence we should not have parameters like this. tools/workspace/numpy/repository.bzl, line 32 at r1 (raw file):
Once it is accepted, I remove this comment and I will upload to S3 ( tools/workspace/numpy/repository.bzl, line 45 at r1 (raw file):
"look for love" is imprecise language. tools/workspace/numpy/repository.bzl, line 48 at r1 (raw file):
"silly" is an opinion, so remove. tools/workspace/numpy/repository.bzl, line 131 at r1 (raw file):
Seems strange to add a default argument and then add this check. Maybe I am missing something. tools/workspace/numpy/experimental/build_direct.sh, line 1 at r1 (raw file):
Personally, I would not put this under tools and I don't like having the "experimental" name in the path. Either it is production quality or it should not be in this repo. tools/workspace/numpy/experimental/build_direct.sh, line 2 at r1 (raw file):
BTW tools/workspace/numpy/experimental/build_mac.sh, line 2 at r1 (raw file):
As above. tools/workspace/numpy/experimental/build_ubuntu.sh, line 2 at r1 (raw file):
As above. tools/workspace/numpy/experimental/Dockerfile, line 6 at r1 (raw file):
tools/workspace/numpy/experimental/Dockerfile, line 7 at r1 (raw file):
Installing simple tools/workspace/numpy/experimental/Dockerfile, line 10 at r1 (raw file):
tools/workspace/numpy/experimental/README.md, line 1 at r1 (raw file):
As above, either this is production or not here. tools/workspace/numpy/test/numpy_test.py, line 3 at r1 (raw file):
We should require. We don't allow dev versions of anything else, and we should not this. Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, 16 unresolved discussions. tools/workspace/numpy/experimental/build_mac.sh, line 5 at r1 (raw file):
List them here or add a script. Comments from Reviewable |
Review status: 0 of 12 files reviewed at latest revision, 17 unresolved discussions, some commit checks failed. a discussion (no related file): Previously, EricCousineau-TRI (Eric Cousineau) wrote…
Aside: @EricCousineau-TRI could you please mark yourself hard blocking here (⛔) so that the red bubble shows up in your console instead of mine? a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
Given the recent comments on numpy maintainers on numpy/numpy#10898, I think its likely that the patch will merge soonish, so it's okay to proceed reviewing this PR under the hypothetical that numpy merges to master (and hopefully even tags a release). I'd encourage @EricCousineau-TRI to push a second draft that responds to the comments so that we have time to ponder and review what a more final form of this PR would look like. Comments from Reviewable |
a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Shall do! Comments from Reviewable |
2b3e031
to
e533cd2
Compare
Review status: 0 of 13 files reviewed at latest revision, 17 unresolved discussions. tools/workspace/numpy/repository.bzl, line 24 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/repository.bzl, line 32 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
OK Thanks! tools/workspace/numpy/repository.bzl, line 45 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/repository.bzl, line 48 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/repository.bzl, line 131 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. No longer relevant, but I had done this because tools/workspace/numpy/test/numpy_test.py, line 3 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/build_direct.sh, line 1 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. Renamed to tools/workspace/numpy/experimental/build_direct.sh, line 2 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/build_mac.sh, line 2 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/build_mac.sh, line 5 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. Added tools/workspace/numpy/experimental/build_ubuntu.sh, line 2 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/Dockerfile, line 7 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/Dockerfile, line 10 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/experimental/README.md, line 1 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. Comments from Reviewable |
Review status: 0 of 13 files reviewed at latest revision, 3 unresolved discussions. tools/workspace/default.bzl, line 147 at r2 (raw file):
I think it is pretty universal that we name things tools/workspace/numpy/BUILD.bazel, line 4 at r2 (raw file):
Comment is no longer needed since the file is now more than a placeholder. Comments from Reviewable |
Checkpoint review of most pieces. I'll review (and test) the packaging instructions in more detail once its pointing to numpy master. Reviewed 4 of 17 files at r1, 4 of 19 files at r2. bindings/pydrake/third_party/BUILD.bazel, line 75 at r2 (raw file):
I think repository install dependencies usually go into tools/workspace/numpy/repository.bzl, line 96 at r2 (raw file):
Since we are installing our own build of numpy, it seems like this target should have some tools/workspace/numpy/repository.bzl, line 102 at r2 (raw file):
FYI I suggest moving this into tools/workspace/pybind11/package.BUILD.bazel, line 47 at r2 (raw file):
FYI Confirm my understanding -- this is not required, because tools/workspace/numpy/packaging/README.md, line 1 at r2 (raw file):
Probably the first thing in the readme should explain why we are doing this. (Something like: in order for tools/workspace/numpy/packaging/README.md, line 13 at r2 (raw file):
Somewhere in here, the workflow for changing the numpy version we're using should be explained. (Something like: change the tag in build_direct, and open a PR; run these commands and post a link to their output in the PR, and then ping Jamie to upload after review? Maybe there's a TODO or issue to automate the rebuild, also?) Comments from Reviewable |
984344e
to
d84be2a
Compare
Review status: 2 of 16 files reviewed at latest revision, 11 unresolved discussions. tools/workspace/default.bzl, line 147 at r2 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done... but definitely awkward. tools/workspace/numpy/BUILD.bazel, line 4 at r2 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/repository.bzl, line 96 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/workspace/numpy/repository.bzl, line 102 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/workspace/pybind11/package.BUILD.bazel, line 47 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Yup! bindings/pydrake/third_party/BUILD.bazel, line 75 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/workspace/numpy/experimental/Dockerfile, line 6 at r1 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Done. tools/workspace/numpy/packaging/README.md, line 1 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. tools/workspace/numpy/packaging/README.md, line 13 at r2 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
Reviewed 5 of 19 files at r2, 10 of 11 files at r3. a discussion (no related file): a discussion (no related file): tools/workspace/numpy/BUILD.bazel, line 7 at r3 (raw file):
BTW Unused. tools/workspace/numpy/packaging/Brewfile, line 1 at r3 (raw file):
I'm not sure what this file is to be used for. Nothing seems to refer to it? Does something implicitly use it? I guess for me at least some comments here or in the README would help. Comments from Reviewable |
Review status: all files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
This is complicated. The short answer is, of course, yes, but we will still be getting a discussion (no related file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
A wheel would conflict with the Homebrew version, so it would need to be coupled with a purging of use of other formulae that use I think slowing down the integration of fixes from Comments from Reviewable |
Review status: all files reviewed at latest revision, 9 unresolved discussions, some commit checks failed. tools/install/install_test.py, line 30 at r3 (raw file):
Remove? Comments from Reviewable |
Review status: all files reviewed at latest revision, 8 unresolved discussions, some commit checks failed. tools/workspace/numpy/packaging/Brewfile, line 1 at r3 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
It is mentioned in the README in this folder ( Comments from Reviewable |
tools/workspace/numpy/packaging/Brewfile, line 1 at r3 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
Aha, thanks! Withdrawn. Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. tools/install/install_test.py, line 30 at r3 (raw file): Previously, jamiesnape (Jamie Snape) wrote…
FYI I was fine leaving this output intact to help discriminate which test is being run. The output here is muted by bazel test runner unless the test fails (at which point there is already a lot of output already printed.) Comments from Reviewable |
Review status: all files reviewed at latest revision, 6 unresolved discussions, some commit checks failed. a discussion (no related file): Previously, jamiesnape (Jamie Snape) wrote…
FYI, Personally, +1 for waiting for the new release and use it via Comments from Reviewable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 17 files at r13.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/numpy/repository.bzl, line 30 at r13 (raw file):
wheels = { "ubuntu_16.04": { "url": "https://files.pythonhosted.org/packages/40/c5/f1ed15dd931d6667b40f1ab1c2fe1f26805fc2b6c3e25e45664f838de9d0/numpy-1.15.2-cp27-cp27mu-manylinux1_x86_64.whl", # noqa
We will want to have a way to list more than one mirror here. In fact, mirrors.bzl already has one, that we should use. In fact, we already have pypi.bzl that we should take advantage of, or else at least cite here with a justification for not using it.
tools/workspace/numpy/repository.bzl, line 73 at r13 (raw file):
) numpy_py_repository = repository_rule(
Hmm, why did this gain an extra py? We don't have extra "_py" suffix in Drake for any of the other python externals.
Also, now the tools/workspace/DIR doesn't match the macro name.
tools/workspace/numpy/test/numpy_test.py, line 7 at r13 (raw file):
import numpy as np import numpy as np
nit Duplicates the import above.
tools/workspace/numpy/test/numpy_test.py, line 18 at r13 (raw file):
"WORKSPACE and usage of `numpy_py_repository` are well-formed.") # N.B. This should be updated each time the version is bumped. self.assertEqual("1.15.2", np.version.version)
nit Please be consistent in the "1.15.2" vs "np.version.version" argument order, for this numpy_test.py vs numpy_install_test.py.
e2fc77a
to
0d40789
Compare
0d40789
to
a3dde2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dismissed @jamiesnape from a discussion.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
Previously, jamiesnape (Jamie Snape) wrote…
My impression too.
Done.
tools/workspace/numpy/repository.bzl, line 30 at r13 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
We will want to have a way to list more than one mirror here. In fact, mirrors.bzl already has one, that we should use. In fact, we already have pypi.bzl that we should take advantage of, or else at least cite here with a justification for not using it.
Done.
tools/workspace/numpy/repository.bzl, line 73 at r13 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Hmm, why did this gain an extra py? We don't have extra "_py" suffix in Drake for any of the other python externals.
Also, now the tools/workspace/DIR doesn't match the macro name.
Done. (Hoisted statement this into Warning:
in docstring.)
@drake-jenkins-bot linux-bionic-unprovisioned-clang-bazel-experimental please. |
This simplest PR that uses this is captured in #9997. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 6 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
"https://s3.amazonaws.com/drake-mirror/pypi/{package}/{package}-{version}.tar.gz", # noqa ], "pypi-general": [
Do we really need another mirror type? I think you can modify pypi_archive
to make it satisfy both cases and will happily duplicate any existing packages to https://drake-mirror.csail.mit.edu/pypi/source
and put the numpy ones in ``https://drake-mirror.csail.mit.edu/pypi`.
tools/workspace/numpy_py/package.noop.BUILD.bazel, line 9 at r14 (raw file):
# No-op to permit using system library. py_library(
I think we can have a proper target here. The files are in predictable locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 6 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
Do we really need another mirror type? I think you can modify
pypi_archive
to make it satisfy both cases and will happily duplicate any existing packages tohttps://drake-mirror.csail.mit.edu/pypi/source
and put the numpy ones in ``https://drake-mirror.csail.mit.edu/pypi`.
Actually, you can use hash_path/filename for sources too, so just add an argument for wheel name to pypi_archive and I will upload the numpy archives to https://drake-mirror.csail.mit.edu/pypi/{package}/{wheel}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small checkpoint. I'll come back to it later this week.
Reviewed 15 of 24 files at r14.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
bindings/pydrake/BUILD.bazel, line 48 at r14 (raw file):
"//bindings/pydrake/util:compatibility_py", "//bindings/pydrake/util:deprecation_py", "@numpy_py",
nit This seems weird / unused. The __init__.py
doesn't use np. Sure, the :compatibility_py
uses it, but then it should be a deps
of the util target, not this one? Or if we do really need an apparently-unused deps line, it needs a comment to explain why not to accidentally remove it.
bindings/pydrake/util/BUILD.bazel, line 62 at r14 (raw file):
srcs = ["__init__.py"], imports = PACKAGE_INFO.py_imports, deps = ["@numpy_py"],
nit This seems weird / unused. The __init__.py
doesn't use np. Sure, the :compatibility_py
uses it, but then it should be a deps
of the util target, not this one? Or if we do really need an apparently-unused deps line, it needs a comment to explain why not to accidentally remove it.
bindings/pydrake/util/compatibility.py, line 21 at r14 (raw file):
minimum = NumpyVersion('1.15.0') if actual < minimum: raise RuntimeError(
Remind me how much of pydrake
will be broken if we don't have it? I am wondering if an exception on import is too severe -- perhaps only certain modules should have a hard requirement?
tools/workspace/numpy/repository.bzl, line 30 at r13 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
Done.
OK Indeed, as Jamie noted separately, if we're not going to use pypi.bzl we need a comment explaining why. (Really, we should just use pypi.bzl though.)
tools/workspace/numpy_py/BUILD.bazel, line 7 at r14 (raw file):
"//tools/skylark:drake_py.bzl", "drake_py_unittest", )
nit Unused.
a3dde2b
to
581228c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 5 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
bindings/pydrake/BUILD.bazel, line 48 at r14 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
nit This seems weird / unused. The
__init__.py
doesn't use np. Sure, the:compatibility_py
uses it, but then it should be adeps
of the util target, not this one? Or if we do really need an apparently-unused deps line, it needs a comment to explain why not to accidentally remove it.
Done.
bindings/pydrake/util/BUILD.bazel, line 62 at r14 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
nit This seems weird / unused. The
__init__.py
doesn't use np. Sure, the:compatibility_py
uses it, but then it should be adeps
of the util target, not this one? Or if we do really need an apparently-unused deps line, it needs a comment to explain why not to accidentally remove it.
Done.
bindings/pydrake/util/compatibility.py, line 21 at r14 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Remind me how much of
pydrake
will be broken if we don't have it? I am wondering if an exception on import is too severe -- perhaps only certain modules should have a hard requirement?
OK Given how pervasively numpy
is used in pydrake
, I'd prefer to fail as fast as possible.
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
Actually, you can use hash_path/filename for sources too, so just add an argument for wheel name to pypi_archive and I will upload the numpy archives to
https://drake-mirror.csail.mit.edu/pypi/{package}/{wheel}
OK Tried it out... I can't say things look all that better from a usage standpoint for pypi_archive
, but now there are only two usages, and they are both distinct (macro vs. rule), in all of Drake + Anzu.
tools/workspace/numpy/repository.bzl, line 30 at r13 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Indeed, as Jamie noted separately, if we're not going to use pypi.bzl we need a comment explaining why. (Really, we should just use pypi.bzl though.)
OK Put a TODO which could be re-done pending #10002.
tools/workspace/numpy_py/package.noop.BUILD.bazel, line 9 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
I think we can have a proper target here. The files are in predictable locations.
OK Would prefer not to, at least in this PR.
It's how we've been pulling in system dependencies, and would prefer that another PR focus specifically on this (esp. if we can make an issue as to why we want to do this).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/numpy_py/package.noop.BUILD.bazel, line 9 at r14 (raw file):
It's how we've been pulling in system dependencies, and would prefer that another PR focus specifically on this (esp. if we can make an issue as to why we want to do this).
That is not really true and I think you will find it is only 2-3 more lines of code. We have always had parity the content of dependencies between Mac and Linux and a no-op target is not a design pattern we should promote even temporarily, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 8 files at r15.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
bindings/pydrake/util/compatibility.py, line 21 at r14 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
OK Given how pervasively
numpy
is used inpydrake
, I'd prefer to fail as fast as possible.
You are almost certainly correct in that assessment, but I still would like an answer my question so that I can understand (and we can document as part of this PR thread) that line of reasoning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
OK Tried it out... I can't say things look all that better from a usage standpoint for
pypi_archive
, but now there are only two usages, and they are both distinct (macro vs. rule), in all of Drake + Anzu.
Well, the old naming scheme (that was used for source files in our case) is changed/partially broken anyway now (technically it was not part of an API, so deprecated is not the correct word), so this would have had to be done in some form anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
Well, the old naming scheme (that was used for source files in our case) is changed/partially broken anyway now (technically it was not part of an API, so deprecated is not the correct word), so this would have had to be done in some form anyway.
581228c
to
8a12e03
Compare
ubuntu: Provide NumPy Remove apt dependencies on NumPy
8a12e03
to
b263eb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
tools/workspace/mirrors.bzl, line 52 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
OK Gotcha, makes sense then!
bindings/pydrake/util/compatibility.py, line 21 at r14 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
You are almost certainly correct in that assessment, but I still would like an answer my question so that I can understand (and we can document as part of this PR thread) that line of reasoning.
Done. Added in a comment to the function in renamed file.
tools/workspace/numpy_py/package.noop.BUILD.bazel, line 9 at r14 (raw file):
Previously, jamiesnape (Jamie Snape) wrote…
It's how we've been pulling in system dependencies, and would prefer that another PR focus specifically on this (esp. if we can make an issue as to why we want to do this).
That is not really true and I think you will find it is only 2-3 more lines of code. We have always had parity the content of dependencies between Mac and Linux and a no-op target is not a design pattern we should promote even temporarily, I think.
Done. (Added it via repository.bzl
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've finished a code review pass up to latest r16. I should still probably re-test locally, after the next round of fixes.
Reviewed 1 of 24 files at r14, 3 of 8 files at r15, 9 of 11 files at r16.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
It is possible that we should rethink whether the //:install
rule should install numpy onto Drake's python path (for Ubuntu). Given the "Drake installed a broken meshcat, just rm -rf $drake_prefix/lib/python2.7/meshcat
and then it will fall back to your pip" experience of late, it is possible that users should have to opt-in to our installed third-party python packages, via a different path, instead of always being forced to eat them when they add pydrake to their path.
tools/workspace/numpy_py/repository.bzl, line 8 at r16 (raw file):
the minimum required version. See `check_required_numpy_version` in `pydrake/util/compatibility.py` for more
nit s/util/common/
.
tools/workspace/numpy_py/repository.bzl, line 31 at r16 (raw file):
Arguments: name: A unique name for this rule. mirrors: Mirrors for download that must have entries for "pypi-general".
nit pypi-general
is stale.
tools/workspace/numpy_py/repository.bzl, line 105 at r16 (raw file):
repository_ctx.download_and_extract( url = urls, sha256 = wheel["sha256"],
nit Consider wheel["sha256"] or "0" * 64
here, so that the sha is never ever blank. A naive developer might null it out in the dict above, since that's what they can do everywhere else too.
tools/workspace/numpy_py/package.BUILD.bazel.in, line 27 at r16 (raw file):
) @INSTALL_CLAUSE@
FYI Another way to do this is to load instead of textual substitution of the@INSTALL_CLAUSE@
:
load(":helper.bzl", "maybe_declare_install")
maybe_declare_install()
... and then in repository.bzl
symlink either helper-macos.bzl
or helper-ubuntu.bzl
in place depending on the OS. That makes the linter apply to the install fragments, and generally keeps load-time code and build-time code in separate files.
tools/workspace/numpy/package.BUILD.bazel, line 35 at r13 (raw file):
data_dest = "lib/python2.7/site-packages", visibility = ["//visibility:public"], )
As of r3 there was an install_tests = []
here, dropped as of r14. Where did this test go? It seems to me, since we're installing a custom numpy on Ubuntu, that we should test that numpy works correctly in the installed file layout.
First, fo test numpy vs drake, probably either drake/bindings/pydrake/test/common_install_test.py
should call check_required_numpy_version
specifically in a test case, or else all_install_test.py
should do it? You could even imagine using a custom dtype after calling the version check.
(I guess there's also an argument that the import-level check is already good enough, as long as we are sure that we've run it as part of one of those two test cases, so maybe a comment somewhere is good enough. But adding a three-line test seems easy and very much clearer.)
Second, I also think its important to test numpy on its own, without importing pydrake. So I still think that this workspace install rule (on Ubuntu) should have its own install_tests = []
entry that just imports and uses numpy, without importing pydrake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
It is possible that we should rethink whether the //:install rule should install numpy onto Drake's python path (for Ubuntu). Given the "Drake installed a broken meshcat, just rm -rf $drake_prefix/lib/python2.7/meshcat and then it will fall back to your pip" experience of late, it is possible that users should have to opt-in to our installed third-party python packages, via a different path, instead of always being forced to eat them when they add pydrake to their path.
I think that is an overreaction, but I really have never been on board with this PR, so I guess I agree with the numpy sentiment. However, if we are not going to install it, then we should not require it, and therefore this PR has little purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
Previously, jamiesnape (Jamie Snape) wrote…
It is possible that we should rethink whether the //:install rule should install numpy onto Drake's python path (for Ubuntu). Given the "Drake installed a broken meshcat, just rm -rf $drake_prefix/lib/python2.7/meshcat and then it will fall back to your pip" experience of late, it is possible that users should have to opt-in to our installed third-party python packages, via a different path, instead of always being forced to eat them when they add pydrake to their path.
I think that is an overreaction, but I really have never been on board with this PR, so I guess I agree with the numpy sentiment. However, if we are not going to install it, then we should not require it, and therefore this PR has little purpose.
I agree that not installing it would be poor, since its required.
The question is more like, if the user has their own (newer) numpy from pip already on their pythonpath (say, virtualenv), do we want pydrake
's pythonpath to unconditionally shadow numpy? If pydrake and third-party-python were two different pythonpaths, the user could decide whether to use drake's third-party-python, or to only take pydrake (and be responsible for the dependencies). We could probably sugar up the ergonomics.
We don't have to gold plat it all yet, but I do want to be sure we agree on the rough path, before we start putting numpy on the pydrake's pythonpath if we think that path is too dangerous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
I agree that not installing it would be poor, since its required.
The question is more like, if the user has their own (newer) numpy from pip already on their pythonpath (say, virtualenv), do we want
pydrake
's pythonpath to unconditionally shadow numpy? If pydrake and third-party-python were two different pythonpaths, the user could decide whether to use drake's third-party-python, or to only take pydrake (and be responsible for the dependencies). We could probably sugar up the ergonomics.We don't have to gold plat it all yet, but I do want to be sure we agree on the rough path, before we start putting numpy on the pydrake's pythonpath if we think that path is too dangerous.
I am certainly all for providing a mechanism to ditch Drake's numpy
when a user wants to (as I find that super useful when wanting to burrow into Python+GDB+Valgrind) , and it should be relatively easy since we already have the logic for Mac.
For now, I can just add a simple binary switch, and we can float that to some more user-friendly argument if it's an issue.
From working with pytorch
a bit myself, I haven't seen any issues (at least at inference time with SSD-6D based networks) when using a later version of NumPy, since it's ABI is relatively robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 7 unresolved discussions, LGTM missing from assignee jamiesnape, platform LGTM from [jwnimmer-tri], labeled "do not merge"
a discussion (no related file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
I am certainly all for providing a mechanism to ditch Drake's
numpy
when a user wants to (as I find that super useful when wanting to burrow into Python+GDB+Valgrind) , and it should be relatively easy since we already have the logic for Mac.For now, I can just add a simple binary switch, and we can float that to some more user-friendly argument if it's an issue.
From working with
pytorch
a bit myself, I haven't seen any issues (at least at inference time with SSD-6D based networks) when using a later version of NumPy, since it's ABI is relatively robust.
A configuration option is another kind of burden. Might still need to think more / discuss.
(In any case, plenty of other discussions below to fix first.)
Closing for now. Can re-open later. |
First checkbox in #8116
Uses commit from numpy/numpy#10898
This change is