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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find package for @rules_python_internal//:rules_python_config.bzl: The repository '@rules_python_internal' could not be resolved: Repository '@rules_python_internal' is not defined. #872

Open
ensonic opened this issue Jun 12, 2024 · 7 comments
Labels
p4 An idea that we are not considering working on at this time. question

Comments

@ensonic
Copy link

ensonic commented Jun 12, 2024

WORKSPACE:

http_archive(
    name = "rules_pkg",
    sha256 = "d250924a2ecc5176808fc4c25d5cf5e9e79e6346d79d5ab1c493e289e722d1d0",
    urls = [
        "https://github.com/bazelbuild/rules_pkg/releases/download/0.10.1/rules_pkg-0.10.1.tar.gz",
    ],
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()

//src/bootstrap/cloud/BUILD:

...

pkg_tar(
    name = "files",
    srcs = [
        "//:config.sh.tmpl",
        "//src/bootstrap/cloud/terraform",
    ],
    mode = "644",
    strip_prefix = "/",
)

Error:

bazel test //...
Starting local Bazel server and connecting to it...
INFO: Streaming build results to: <redacted>
ERROR: Analysis of target '//src/bootstrap/cloud:files' failed; build aborted: error loading package '@rules_pkg//pkg/private': at /usr/local/google/home/ensonic/.cache/bazel/_bazel_ensonic/88cafc24ebbba21bc2294727bc8fc64d/external/rules_python/python/defs.bzl:21:6: at /usr/local/google/home/ensonic/.cache/bazel/_bazel_ensonic/88cafc24ebbba21bc2294727bc8fc64d/external/rules_python/python/py_runtime_info.bzl:17:6: Unable to find package for @rules_python_internal//:rules_python_config.bzl: The repository '@rules_python_internal' could not be resolved: Repository '@rules_python_internal' is not defined.

We're not using any rules_python in the repo. This issue is blocking googlecloudrobotics/core#373

@aiuto
Copy link
Collaborator

aiuto commented Jun 12, 2024

This looks like a python problem.
You should probably pin to a newer rules python in your WORKSPACE or MODULE.bazel

@aiuto aiuto added question p4 An idea that we are not considering working on at this time. labels Jun 12, 2024
@ensonic
Copy link
Author

ensonic commented Jun 12, 2024

We're not using any rules_python like I said:
https://github.com/googlecloudrobotics/core/blob/main/WORKSPACE

@aiuto
Copy link
Collaborator

aiuto commented Jun 12, 2024

Sure, but you are using other things. Everything you bring in to your WORKSPACE can impact what bzlmod resolves all the transitive dependencies too. Sometimes you just have to force things to specific versions in your project.

@ensonic
Copy link
Author

ensonic commented Jun 12, 2024

So what rules_python version do you need to pkg_tar, just add it to you readme and I am happy to apply that workaround

@ensonic
Copy link
Author

ensonic commented Jun 14, 2024

@aiuto
Copy link
Collaborator

aiuto commented Jun 14, 2024

The one in MODULE.bazel or WORKSPACE should work. Probably everything newer than that does too.
But that is not a requirement, nor even a recommendation. There is no way to know from the point of view of rules_pkg, what version of rules_python that you need to interoperate with all the other things you need. This is a Bazel ecosystem wide problem.

A reasonable practice for an end user is:

  • explicitly specify in foundational modules first (bazel-skylib, rules_license) first in WORKSPACE
  • then specify the newest stable versions of the transitive collection of tools required by the modules I use.
  • then specify the modules I directly use
  • finally, call all the add_foo_dependencies()

And then juggle that around until it works. But there are problems, because the add dependencies methods are sometimes written with maybe() style loads, and sometimes not. So possibly a_x_dependencies() will override your previously specified choice.

If I were building a product with Bazel, I would use the workspace tools only to query out what I need, and explicitly specify the versions of every transitive module required. That way I know that updating, for example, rules_python, won't change the version of rules_proto that I use.

@Mizux
Copy link

Mizux commented Sep 3, 2024

My 2 cents,
Got the same issue, fixed using this in the WORKSPACE:

 git_repository(
  name = "rules_python",
  tag = "0.31.0",
  remote = "https://github.com/bazelbuild/rules_python.git",
)

# if missing it will trig the error message of the OP
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4 An idea that we are not considering working on at this time. question
Projects
None yet
Development

No branches or pull requests

3 participants