Skip to content

[Bug]: venv_shim/shim not created error #738

@peakschris

Description

@peakschris

What happened?

rules_py is not working for me, any rule that creates a venv directly or as side-effect causes the error:
ERROR: /apps/b/234c0a448c55fecb3e137de569a670ec/external/aspect_rules_py+/py/tools/venv_shim/BUILD.bazel:5:12: output 'external/aspect_rules_py+/py/tools/venv_shim/shim' was not created
ERROR: /apps/b/234c0a448c55fecb3e137de569a670ec/external/aspect_rules_py+/py/tools/venv_shim/BUILD.bazel:5:12: Compiling Rust bin shim (1 files) failed: not all outputs were created or valid

latest commit of rules_py
rockylinux 9.6

src/mymodule/BUILD.bazel:

load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_binary")

py_venv_binary(
    name = "foo",
    srcs = glob(["*.py"]),
    main = "entrypoint.py",
    deps = [
        "//src/myservice/libs/math",
    ],
    venv = "a",
)

MODULE.bazel:

bazel_dep(name = "aspect_rules_py", version = "1.6.6")
bazel_dep(name = "rules_python", version = "1.4.0")

RULES_PY_TAG = "d22cb6818e672b6d30bbeb87cf8c6e14f3f0a70e"
RULES_PY_INTEGRITY = "sha256-std7leFpfO/X2J6V20kmGhk7e+boPSDx66Unfal8qJQ="
archive_override(
    strip_prefix = "rules_py-" + RULES_PY_TAG,
    integrity = RULES_PY_INTEGRITY,
    module_name = "aspect_rules_py",
    urls = ["https://github.com/aspect-build/rules_py/archive/" + RULES_PY_TAG + ".zip"],
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    ignore_root_user_error = True,
    is_default = True,
    python_version = "3.13",
)

uv = use_extension("@aspect_rules_py//uv/unstable:extension.bzl", "uv")
uv.declare_hub(hub_name = "pypi")
uv.declare_venv(hub_name = "pypi", venv_name = "a")
uv.lockfile(hub_name = "pypi", venv_name = "a", src = "//:uv.lock")
use_repo(uv, "pypi")

.bazelrc (required for successful rust builds):

common --linkopt=-optl-no-pie
common --force_pic
common --copt="-fPIC"
common --@pypi//venv=a

pyproject% bazel build //src/myservice/tests:pytest_test.venv --verbose_failures

INFO: Analyzed target //src/myservice/tests:pytest_test.venv (530 packages loaded, 37680 targets configured).
ERROR: /apps/b/234c0a448c55fecb3e137de569a670ec/external/aspect_rules_py+/py/tools/venv_shim/BUILD.bazel:5:12: output 'external/aspect_rules_py+/py/tools/venv_shim/shim' was not created
ERROR: /apps/b/234c0a448c55fecb3e137de569a670ec/external/aspect_rules_py+/py/tools/venv_shim/BUILD.bazel:5:12: Compiling Rust bin shim (1 files) failed: not all outputs were created or valid
Target //src/myservice/tests:pytest_test.venv failed to build
INFO: Elapsed time: 34.282s, Critical Path: 1.52s
INFO: 9 processes: 824 action cache hit, 8 internal, 1 linux-sandbox.
ERROR: Build did NOT complete successfully

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions