-
-
Notifications
You must be signed in to change notification settings - Fork 632
Fix Python interpreter target labels with @@ prefixes. #940
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
Fix Python interpreter target labels with @@ prefixes. #940
Conversation
829206c
to
ba30b71
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.
Could you update the bzlmod example to include this, please?
6951d96
to
a4be55b
Compare
a4be55b
to
5d42fb6
Compare
@f0rmiga I pushed a WIP commit with the updated example but it won't pass CI as there is no way to get execution platform at this stage. It would be also wrong to build wheels using an execution platform unless it is guaranteed that it is similar to target one. With the following code
I stuck with a problem how to conditionally load one of
Would it be ok to not update the example? Frankly, |
Seems to fail on Windows and OS X for the example, because of the hardcoded dependency on Linux. Any neat way to handle this? I dug through the code and saw that for the pre-bzlmod system there was a "interpreter" field exposed. Would be fantastic to get this PR fixed up and merged. |
To correctly use toolchains for the external PyPI dependencies, I believe we need to do the following:
Would folks be happy if we moved to a "binary only" / "download only" implementation for bzlmod? It's fairly straightforward to migrate whl_library away from a repository rule if we don't need to use |
ERROR: An error occurred during the fetch of repository 'rules_python~0.16.1~pip~pip': Traceback (most recent call last): File "/home/miha/.cache/bazel/_bazel_miha/bd93af10788cff1331d75ed739998a3c/external/rules_python~0.16.1/python/pip_install/pip_repository.bzl", line 335, column 63, in _pip_repository_impl environment = _create_repository_execution_environment(rctx), File "/home/miha/.cache/bazel/_bazel_miha/bd93af10788cff1331d75ed739998a3c/external/rules_python~0.16.1/python/pip_install/pip_repository.bzl", line 210, column 47, in _create_repository_execution_environment cppflags.extend(_get_toolchain_unix_cflags(rctx)) File "/home/miha/.cache/bazel/_bazel_miha/bd93af10788cff1331d75ed739998a3c/external/rules_python~0.16.1/python/pip_install/pip_repository.bzl", line 115, column 37, in _get_toolchain_unix_cflags if not is_standalone_interpreter(rctx, rctx.attr.python_interpreter_target): File "/home/miha/.cache/bazel/_bazel_miha/bd93af10788cff1331d75ed739998a3c/external/rules_python~0.16.1/python/repositories.bzl", line 64, column 22, in is_standalone_interpreter rctx.path(Label("@{}//:WORKSPACE".format(rctx.attr.python_interpreter_target.workspace_name))).dirname, Error in path: Unable to load package for @[unknown repo 'rules_python~0.16.1~python~python3_10_x86_64-unknown-linux-gnu' requested from @rules_python~0.16.1]//:WORKSPACE: The repository '@[unknown repo 'rules_python~0.16.1~python~python3_10_x86_64-unknown-linux-gnu' requested from @rules_python~0.16.1]' could not be resolved: No repository visible as '@rules_python~0.16.1~python~python3_10_x86_64-unknown-linux-gnu' from repository '@rules_python~0.16.1'
5d42fb6
to
f70e0d2
Compare
I have removed WIP commit, so the PR is unblocked.
I don't see a way to correctly solve the issue. The
This is exactly my use case that requires building wheels for the following requirements.txt
as mmcv setup.py script checks if torch is installed to build the extensions module. My use case also requires #942 as dependencies have to be installed before mmcv:
Using the "download only" implementation will still require building mmcv with some torch version outside the bazel environment. |
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.
Even though there are other solutions to the problem we envision, this PR solves the immediate issue while not going in the wrong direction.
Fixes #930 the following errors with bzlmod modules:
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
The PR correctly references python interpreter target labels as
@@rules_python~0.16.1~python~python3_10_x86_64-unknown-linux-gnu//:WORKSPACE
and allows to use