scele / rules_python

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

Deal with broken packages like nvidia-ml-py #19

Closed therc closed 5 years ago

therc commented 5 years ago

nvidia-ml-py has an interesting problem: the file name for the latest version is 375.53.tar,gz, but the version inside is 375.53.1. No matter which version you specify in requirements.txt, it breaks. For example, if you try running the branch from #18:

$ bazel test --test_output=errors //examples/helloworld:all
Collecting nvidia-ml-py==375.53.1
Collecting futures==3.2.0
  Could not find a version that satisfies the requirement nvidia-ml-py==375.53.1 (from versions: 1.0, 2.285.1, 3.295.0, 4.304.2, 4.304.3, 4.304.4, 6.340.0, 7.346.0, 7.352.0, 375.53)
No matching distribution found for nvidia-ml-py==375.53.1
ERROR: Analysis of target '//examples/helloworld:helloworld_test' failed; build aborted: no such package '@examples_helloworld__nvidia_ml_py_375_53_1//': no such package '@examples_helloworld__nvidia_ml_py_375_53_1_wheel//': Traceback (most recent call last):
    File "[...]/external/io_bazel_rules_python/python/whl.bzl", line 156
        _build_wheel(ctx)
    File "[...]/external/io_bazel_rules_python/python/whl.bzl", line 143, in _build_wheel
        fail(("pip wheel failed: %s (%s)" % (...)))
pip wheel failed: Collecting nvidia-ml-py==375.53.1
 (  Could not find a version that satisfies the requirement nvidia-ml-py==375.53.1 (from versions: 1.0, 2.285.1, 3.295.0, 4.304.2, 4.304.3, 4.304.4, 6.340.0, 7.346.0, 7.352.0, 375.53)
No matching distribution found for nvidia-ml-py==375.53.1
)
INFO: Elapsed time: 40.824s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (9 packages loaded)
FAILED: Build did NOT complete successfully (9 packages loaded)

One workaround is to postprocess the generated .bzl file to replace 375.53.1 with 375.53.

therc commented 5 years ago

At some point you do get this warning in yellow

Requested nvidia-ml-py==375.53 from https://files.pythonhosted.org/packages/8c/63/cd93f1cdaf93c3e4aa1827373492d74de5c58af3613ba1eb3dd5c01f4128/nvidia-ml-py-375.53.tar.gz#sha256=0167a6acff2cb8b21195685da1c4e862c73c5201d06e36f48d5eeb9d1868e28f (from -r /tmp/tmp5eROW_ (line 11)), but installing version 375.53.1

but it's still going to fail at the end.