scele / rules_python

Experimental Bazel Python Rules
Apache License 2.0
2 stars 8 forks source link

Can't use Scipy #16

Closed therc closed 5 years ago

therc commented 5 years ago

See PR #15

Some pyx file missing when using SciPy 1.1.0 (1.2.0 is currently broken because of UTF-8 issues under Python 2.7, a 1.2.1 is going to be released anytime soon). Perhaps you have seen this before?

Adding Cython to the buildtime or runtime dependencies does not make any difference.

scele commented 5 years ago

@therc can you try with https://github.com/scele/rules_python/pull/21?

Note that I've changed the checked-in requirements.bzl format to be simpler, so you'll need to regenerate yours.

therc commented 5 years ago

[...]/external/pip/requirements.bzl: in [...]/external/pip/requirements.gen.bzl: Unable to load package for '@pip//python:whl.bzl': BUILD file not found on package path

Contents of the cache directory:

$ ls [...]/external/pip/
BUILD            WORKSPACE        requirements.bzl     requirements.gen.bzl update.sh

This is in my own tree, not #15...

therc commented 5 years ago

Nevermind, I think I had to use the usual bootstrapping approach, i.e. commenting out the call to pip_install() in WORKSPACE, then running :update. I had the old generated code still around.

therc commented 5 years ago

Now I get further, to...

  File "[...]/external/io_bazel_rules_python/tools/piptool.par/__main__.py", line 811, in main
  File "[...]/external/io_bazel_rules_python/tools/piptool.par/__main__.py", line 689, in resolve
  File "/usr/lib/python2.7/ast.py", line 49, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python2.7/ast.py", line 37, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 7
    _requirements = {
                ^
SyntaxError: invalid syntax
scele commented 5 years ago

The bootstrapping seems to have some rough edges still, sorry about that.. :/

Try putting just wheels = {} into your requirements.bzl before running :update?

therc commented 5 years ago

Retrying, but I'm on a slow connection now. Another reminder to get local caching working...

therc commented 5 years ago

Success! The rules still seem to download a lot more than the pyz ones, maybe because the entire external/pip/ tree gets wiped a bit too often, but that's another story.

scele commented 5 years ago

The rules still seem to download a lot more than the pyz ones, maybe because the entire external/pip/ tree gets wiped a bit too often, but that's another story.

I tried to optimize this in https://github.com/scele/rules_python/pull/21/commits/1dddf2b51f7c258b0cdffccf1ff7fe54eb73fd6b .. If you pull #21 and use digests=True, it should now repository_ctx.download() from files.pythonhosted.org directly, which is what rules_pyz seems to also do. (This optimization does not apply to wheels that need to be downloaded a source tarballs and built locally.) Can you try if this works?

therc commented 5 years ago

It doesn't crash and burn now and it refreshes the requirements.bzl file correctly, but at build time I get lots of warnings like

nvidia_ml_py-375.53.1-py2-none-any.whl digest fe93c7941cc4107ebde7d1a60b6d140ebafa2656d7f7efe50107b443a84302ef does not match expected digest b7ecf2963342bcf556fa58b7dbe3cb594a21f7992f55c2da1333c912ea6d50cb

therc commented 5 years ago

Closing this issue, because scipy works fine now. Thanks!