Skip to content

Build fails during pip install -e . with Bazel rules_python toolchain error (Label has no field repo_name) #21

Description

@As-ajay06

Description

Hi ,

I'm unable to install the project in editable mode because the build fails while Bazel is generating the Python backend extensions.

Environment

  • OS: Ubuntu 22.04 (Docker)
  • Python: 3.11
  • Bazel: 6.3

Steps to reproduce

pip install -e .

Expected behavior

The package should build successfully and install in editable mode.

Actual behavior

The build fails while Bazel is fetching the Python toolchains:

Building editable for envlogger (pyproject.toml) ... error

running build_ext

bazel build //envlogger/backends/python:episode_info.so \
            //envlogger/backends/python:riegeli_dataset_reader.so \
            //envlogger/backends/python:riegeli_dataset_writer.so \
            --symlink_prefix=/tmp/tmpx0c9n6nw.build-temp/bazel- \
            --compilation_mode=opt \
            --verbose_failures \
            --repo_env=PYTHON_BIN_PATH=/usr/bin/python3

Loading:
Loading:
Loading: 0 packages loaded
Analyzing: 3 targets (0 packages loaded, 0 targets configured)

INFO: Repository python_3_11_toolchains instantiated at:
/envlogger/WORKSPACE.bazel:87:27: in <toplevel>

ERROR: An error occurred during the fetch of repository 'python_3_11_toolchains':

Traceback (most recent call last):
  File ".../rules_python/python/private/toolchains_repo.bzl", line 92, column 57, in _toolchains_repo_impl
    rules_python = rctx.attr._rules_python_workspace.repo_name,

Error: 'Label' value has no field or method 'repo_name'

ERROR: Analysis of target '//envlogger/backends/python:riegeli_dataset_writer.so' failed; build aborted: 'Label' value has no field or method 'repo_name'

FAILED: Build did NOT complete successfully
error: command '/usr/bin/bazel' failed with exit code 1

Additional notes

Initially, the build also failed because .bazelrc contained:

build --enable_workspace

which Bazel 6.3 does not recognize. After removing that line, the build progressed further but failed with the rules_python toolchain error shown above.

Could you please confirm:

  • Which Bazel version is currently supported for this repository?
  • Whether the pinned rules_python version (0.27.1) is expected to work with the current codebase?
  • If there are any additional setup steps required before running pip install -e .?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions