ali5h / rules_pip

pip package rules for bazel that are fast (incremental fetch), support different python versions and work with all kinds of packages (i.e. packages with namespaces)
MIT License
60 stars 23 forks source link

`pip_install(["--platform linux_x86_64"]` running `pip wheel` and result in `no such option: --platform linux_x86_64` #68

Closed kchodnicki closed 2 years ago

kchodnicki commented 2 years ago

I have the identical issue as explained here: https://github.com/bazelbuild/rules_python/issues/260#issue-523751319 and I'm trying to implement the suggestion from here: https://github.com/bazelbuild/rules_python/issues/260#issuecomment-565947197.

My WORKSPACE:

## PIP install libs for python
http_archive(
    name = "com_github_ali5h_rules_pip",
    strip_prefix = "rules_pip-3.0.0",
    sha256 = "630a7cab43a87927353efca116d20201df88fb443962bf01c7383245c7f3a623",
    urls = ["https://github.com/ali5h/rules_pip/archive/3.0.0.tar.gz"],
)

load("@com_github_ali5h_rules_pip//:defs.bzl", "pip_import")

pip_import(
    name = "pip_deps",
    requirements = "//third_party/python_requirements:requirements.txt",
    python_interpreter="python3",
)

load("@pip_deps//:requirements.bzl", "pip_install")
pip_install(["--platform linux_x86_64", "--only-binary", ":all"])

Unfortunately, I get the following error:

INFO: Repository pypi__39__grpcio_1_37_1 instantiated at:
  /.../WORKSPACE:98:12: in <toplevel>
  /private/var/tmp/.../e3523c944af0bdd86cccbc59a8209df1/external/pip_deps/requirements.bzl:85:16: in pip_install
Repository rule whl_library defined at:
  /private/var/tmp/.../e3523c944af0bdd86cccbc59a8209df1/external/com_github_ali5h_rules_pip/defs.bzl:126:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'pypi__39__grpcio_1_37_1':
   Traceback (most recent call last):
    File "/private/var/tmp/.../e3523c944af0bdd86cccbc59a8209df1/external/com_github_ali5h_rules_pip/defs.bzl", line 124, column 13, in _whl_impl
        fail("whl_library failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: whl_library failed:  (
Usage:
  whl.py install [options] <requirement specifier> [package-index-options] ...
  whl.py install [options] -r <requirements file> [package-index-options] ...
  whl.py install [options] [-e] <vcs project url> ...
  whl.py install [options] [-e] <local project path> ...
  whl.py install [options] <archive url/path> ...

no such option: --platform linux_x86_64
)

I'm confused why the argument is being passed (as it seems) to pip wheel and not only pip install.

How should I solve this issue?

ali5h commented 2 years ago

it should be pip_install(["--platform", "linux_x86_64", "--only-binary", ":all"])