Skip to content

--@rules_python//python/config_settings:python_version=3.13 not working by default #3318

@Mizux

Description

@Mizux

🐞 bug report

Affected Rule

The issue is caused by the rule: //python/config_settings:python_version

Is this a regression?

I don't think

Description

rules_python auto config doesn't seems to work when targeting python 3.13

🔬 Minimal Reproduction

using the examples/basic in https://github.com/pybind/pybind11_bazel

Protocol:

» git clone https://github.com/pybind/pybind11_bazel
» cd pybind11_bazel/examples/basic
» bazel run --@rules_python//python/config_settings:python_version=3.13 --toolchain_resolution_debug='@bazel_tools//tools/python:toolchain_type' @rules_python//python/bin:repl

expect to have the python interpreter...

note: target taken from the doc: https://rules-python.readthedocs.io/en/latest/repl.html#usage

🔥 Exception or Error

trace:

INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=255
INFO: Reading rc options for 'run' from /usr/local/google/home/user/.../pybind11_bazel/examples/basic/.bazelrc:
  Inherited 'common' options: --announce_rc --enable_bzlmod
WARNING: Build option --@@rules_python+//python/config_settings:python_version has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
INFO: ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_8_aarch64-apple-darwin//:python_runtimes; mismatching config settings: _0000_python_3_8_aarch64-apple-darwin_3.8.20_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_8_aarch64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0001_python_3_8_aarch64-unknown-linux-gnu_3.8.20_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_8_x86_64-apple-darwin//:python_runtimes; mismatching config settings: _0002_python_3_8_x86_64-apple-darwin_3.8.20_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_8_x86_64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0003_python_3_8_x86_64-pc-windows-msvc_3.8.20_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_8_x86_64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0004_python_3_8_x86_64-unknown-linux-gnu_3.8.20_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_aarch64-apple-darwin//:python_runtimes; mismatching config settings: _0005_python_3_9_aarch64-apple-darwin_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_aarch64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0006_python_3_9_aarch64-unknown-linux-gnu_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_ppc64le-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0007_python_3_9_ppc64le-unknown-linux-gnu_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_riscv64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0008_python_3_9_riscv64-unknown-linux-gnu_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_s390x-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0009_python_3_9_s390x-unknown-linux-gnu_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_x86_64-apple-darwin//:python_runtimes; mismatching config settings: _0010_python_3_9_x86_64-apple-darwin_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_x86_64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0011_python_3_9_x86_64-pc-windows-msvc_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_x86_64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0012_python_3_9_x86_64-unknown-linux-gnu_3.9.23_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_9_x86_64-unknown-linux-musl//:python_runtimes; mismatching config settings: _0013_python_3_9_x86_64-unknown-linux-musl_3.9.23_2, _is_py_linux_libc_musl
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_aarch64-apple-darwin//:python_runtimes; mismatching config settings: _0014_python_3_10_aarch64-apple-darwin_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_aarch64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0015_python_3_10_aarch64-unknown-linux-gnu_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_ppc64le-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0016_python_3_10_ppc64le-unknown-linux-gnu_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_riscv64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0017_python_3_10_riscv64-unknown-linux-gnu_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_s390x-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0018_python_3_10_s390x-unknown-linux-gnu_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_x86_64-apple-darwin//:python_runtimes; mismatching config settings: _0019_python_3_10_x86_64-apple-darwin_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_x86_64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0020_python_3_10_x86_64-pc-windows-msvc_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_x86_64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0021_python_3_10_x86_64-unknown-linux-gnu_3.10.18_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_10_x86_64-unknown-linux-musl//:python_runtimes; mismatching config settings: _0022_python_3_10_x86_64-unknown-linux-musl_3.10.18_2, _is_py_linux_libc_musl
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_aarch64-apple-darwin//:python_runtimes; mismatching config settings: _0023_python_3_12_aarch64-apple-darwin_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_aarch64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0024_python_3_12_aarch64-pc-windows-msvc_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_aarch64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0025_python_3_12_aarch64-unknown-linux-gnu_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_ppc64le-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0026_python_3_12_ppc64le-unknown-linux-gnu_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_riscv64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0027_python_3_12_riscv64-unknown-linux-gnu_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_s390x-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0028_python_3_12_s390x-unknown-linux-gnu_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_x86_64-apple-darwin//:python_runtimes; mismatching config settings: _0029_python_3_12_x86_64-apple-darwin_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_x86_64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0030_python_3_12_x86_64-pc-windows-msvc_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_x86_64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0031_python_3_12_x86_64-unknown-linux-gnu_3.12.11_2
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_12_x86_64-unknown-linux-musl//:python_runtimes; mismatching config settings: _0032_python_3_12_x86_64-unknown-linux-musl_3.12.11_2, _is_py_linux_libc_musl
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_aarch64-apple-darwin//:python_runtimes; mismatching config settings: _0033_python_3_11_aarch64-apple-darwin_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_aarch64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0034_python_3_11_aarch64-pc-windows-msvc_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_aarch64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0035_python_3_11_aarch64-unknown-linux-gnu_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_ppc64le-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0036_python_3_11_ppc64le-unknown-linux-gnu_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_riscv64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0037_python_3_11_riscv64-unknown-linux-gnu_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_s390x-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0038_python_3_11_s390x-unknown-linux-gnu_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_x86_64-apple-darwin//:python_runtimes; mismatching config settings: _0039_python_3_11_x86_64-apple-darwin_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_x86_64-pc-windows-msvc//:python_runtimes; mismatching config settings: _0040_python_3_11_x86_64-pc-windows-msvc_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_x86_64-unknown-linux-gnu//:python_runtimes; mismatching config settings: _0041_python_3_11_x86_64-unknown-linux-gnu_3.11.13_1
      ToolchainResolution:   Rejected toolchain @@rules_python++python+python_3_11_x86_64-unknown-linux-musl//:python_runtimes; mismatching config settings: _0042_python_3_11_x86_64-unknown-linux-musl_3.11.13_1, _is_py_linux_libc_musl
      ToolchainResolution: Performing resolution of @@bazel_tools//tools/python:toolchain_type for target platform @@platforms//host:host
      ToolchainResolution: No @@bazel_tools//tools/python:toolchain_type toolchain found for target platform @@platforms//host:host.
ERROR: /usr/local/google/home/corentinl/.cache/bazel/_bazel_corentinl/936ae04c13abe08bc62c225db7a774fc/external/rules_python+/python/bin/BUILD.bazel:27:15: While resolving toolchains for target @@rules_python+//python/bin:repl (f28129c): No matching toolchains found for types:
  @@bazel_tools//tools/python:toolchain_type
To debug, rerun with --toolchain_resolution_debug='@@bazel_tools//tools/python:toolchain_type'
For more information on platforms or toolchains see https://bazel.build/concepts/platforms-intro.
ERROR: Analysis of target '@@rules_python+//python/bin:repl' failed; build aborted
INFO: Elapsed time: 0.148s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

notice that python 3.13 (nor 3.14) is part of the search process...

🌍 Your Environment

Operating System:

» uname -a
Linux user.corp.google.com 6.12.32-1rodete1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.32-1rodete1 (2025-06-26) x86_64 GNU/Linux

Output of bazel version:

» bazel version
WARNING: Invoking Bazel in batch mode since it is not invoked from within a workspace (below a directory having a MODULE.bazel file).
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Build label: 8.4.2
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Wed Oct 01 16:46:46 2025 (1759337206)
Build timestamp: 1759337206
Build timestamp as int: 1759337206

Rules_python version:

» grep "rules_python" MODULE.bazel
bazel_dep(name = "rules_python", version = "1.6.3")

Anything else relevant?

Python 3.12 do work

bazel run --@rules_python//python/config_settings:python_version=3.12 --toolchain_resolution_debug='@bazel_tools//tools/python:toolchain_type' @rules_python//python/bin:repl
[...]
      ToolchainResolution:   Toolchain @@rules_python++python+python_3_12_x86_64-unknown-linux-gnu//:python_runtimes is compatible with target platform, searching for execution platforms:
      ToolchainResolution:     Compatible execution platform @@platforms//host:host
      ToolchainResolution:   All execution platforms have been assigned a @@bazel_tools//tools/python:toolchain_type toolchain, stopping
      ToolchainResolution: Recap of selected @@bazel_tools//tools/python:toolchain_type toolchains for target platform @@platforms//host:host:
      ToolchainResolution:   Selected @@rules_python++python+python_3_12_x86_64-unknown-linux-gnu//:python_runtimes to run on execution platform @@platforms//host:host
INFO: Analyzed target @@rules_python+//python/bin:repl (0 packages loaded, 3001 targets configured).
INFO: Found 1 target...
Target @@rules_python+//python/bin:repl up-to-date:
  bazel-bin/external/rules_python+/python/bin/repl
  bazel-bin/external/rules_python+/python/bin/repl_py.py
INFO: Elapsed time: 0.261s, Critical Path: 0.01s
INFO: 1 process: 6 action cache hit, 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/rules_python+/python/bin/repl
Python 3.12.11 (main, Aug  8 2025, 17:06:48) [Clang 20.1.4 ] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions