Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load Starlark extension '@rules_python_internal//:rules_python_config.bzl' in bzlmod #1543

Closed
geaden opened this issue Nov 7, 2023 · 3 comments

Comments

@geaden
Copy link

geaden commented Nov 7, 2023

馃悶 bug report

Affected Rule

rules_python: 0.26.0

Is this a regression?

Yes, the previous version in which this bug was not present was: 0.25.0

Description

Using `rules_python` in `bzlmod` causes the issue

馃敩 Minimal Reproduction

Run bazel test on any py_test target

馃敟 Exception or Error




ERROR: Failed to load Starlark extension '@rules_python_internal//:rules_python_config.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
 - @rules_python_internal
This could either mean you have to add the '@rules_python_internal' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: Error computing the main repository mapping: cycles detected during computation of main repo mapping

馃實 Your Environment

Operating System:

  
macOS 12.5.1
  

Output of bazel version:

  
Bazelisk version: development
Build label: 6.4.0
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Oct 19 17:08:20 2023 (1697735300)
Build timestamp: 1697735300
Build timestamp as int: 1697735300
  

Rules_python version:

  
0.26.0
  

Anything else relevant?

@rickeylev
Copy link
Contributor

Can you provide repro instructions? Another user reported this on slack, but we weren't able to reproduce it and our tests are OK. The only theory we have is a WORKSPACE file interfering with MODULE.bazel.

@geaden
Copy link
Author

geaden commented Nov 24, 2023

@rickeylev

It turned out I had these lines in WORKSPACE.bazel that caused this error

load(
    "@io_bazel_rules_docker//python3:image.bzl",
    _py_image_repos = "repositories",
)

_py_image_repos()

Wheh I removed it, everything is fine

@mering
Copy link

mering commented Jan 16, 2024

I am having the same problem. As I need images, removing as @geaden suggested is not an option.

With the help of #1560, I re-arranged my imports to call python_register_toolchains() and py_repositories() in deps_1.bzl and then _py_image_repositories() in deps_2.bzl.

@aignas aignas closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants