Skip to content

Conversation

Mizux
Copy link
Collaborator

@Mizux Mizux commented Oct 10, 2025

Try to:

  • migrate bazel form python 3.12 to python 3.13 toolchain as default
  • prepare Python 3.14 by registering a 3.14 toolchain too (note: rules_pytyhon 1.6.3 provide a 3.14)

@Mizux
Copy link
Collaborator Author

Mizux commented Oct 10, 2025

Got lots of errors with the trace:

#13 433.6 ImportError: /root/.cache/bazel/.../somelib.so: undefined symbol: _PyThreadState_UncheckedGet

Could be related t othe use of an older version of cython...
src: cython/cython#1880 (comment)

DevNote

To reproduce

cd bazel
# Build and spawn a  local archlinux container with a bash (@docker #) to reproduce the issue
# `make` to see usage
make sh_amd64_archlinux_devel
root@docker % bazel --version
bazel 8.4.2
root@docker % python --version
Python 3.13.7
root@docker % bazel run @rules_python//python/bin:python --@rules_python//python/config_settings:python_version=3.13 -- --version
...
Python 3.13.6
root@docker % bazel test --config=ci //ortools/linear_solver/python:model_builder_helper_test
...
//ortools/linear_solver/python:model_builder_helper_test                 FAILED in 1.0s

Full Trace:

INFO: Reading 'startup' options from /home/project/.bazelrc: --windows_enable_symlinks
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=127
INFO: Reading rc options for 'test' from /home/project/.bazelrc:
  Inherited 'common' options: --announce_rc
INFO: Reading rc options for 'test' from /home/project/.bazelrc:
  Inherited 'build' options: --flag_alias=with_bop=//ortools/linear_solver:with_bop --flag_alias=with_cbc=//ortools/linear_solver:with_cbc --flag_alias=with_clp=//ortools/linear_solver:with_clp --flag_alias=with_cp_sat=//ortools/linear_solver:with_cp_sat --flag_alias=with_cplex=//ortools/linear_solver:with_cplex --flag_alias=with_glop=//ortools/linear_solver:with_glop --flag_alias=with_glpk=//ortools/linear_solver:with_glpk --flag_alias=with_highs=//ortools/linear_solver:with_highs --flag_alias=with_pdlp=//ortools/linear_solver:with_pdlp --flag_alias=with_scip=//ortools/linear_solver:with_scip --flag_alias=with_xpress=//ortools/linear_solver:with_xpress --define absl=1 --@rules_python//python/config_settings:python_version=3.13 --enable_platform_specific_config --apple_platform_type=macos
INFO: Found applicable config definition build:ci in file /home/project/.bazelrc: --copt=-O1 --keep_going --test_output=errors --test_tag_filters=-noci --test_summary=short --remote_default_exec_properties=cache-silo-key=CleverPeafowl
INFO: Found applicable config definition build:linux in file /home/project/.bazelrc: --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --cxxopt=-Wno-sign-compare --host_cxxopt=-Wno-sign-compare
INFO: Analyzed target //ortools/linear_solver/python:model_builder_helper_test (0 packages loaded, 0 targets configured).
FAIL: //ortools/linear_solver/python:model_builder_helper_test (Exit 1) (see /root/.cache/bazel/_bazel_root/238276933ebafbe5412dd515892860d4/execroot/_main/bazel-out/k8-fastbuild/testlogs/ortools/linear_solver/python/model_builder_helper_test/test.log)
INFO: From Testing //ortools/linear_solver/python:model_builder_helper_test:
==================== Test output for //ortools/linear_solver/python:model_builder_helper_test:
Traceback (most recent call last):
  File "/root/.cache/bazel/_bazel_root/238276933ebafbe5412dd515892860d4/sandbox/processwrapper-sandbox/1683/execroot/_main/bazel-out/k8-fastbuild/bin/ortools/linear_solver/python/model_builder_helper_test.runfiles/_main/ortools/linear_solver/python/model_builder_helper_test.py", line 24, in <module>
    from ortools.linear_solver.python import model_builder_helper
ImportError: /root/.cache/bazel/_bazel_root/238276933ebafbe5412dd515892860d4/sandbox/processwrapper-sandbox/1683/execroot/_main/bazel-out/k8-fastbuild/bin/ortools/linear_solver/python/model_builder_helper_test.runfiles/_main/ortools/linear_solver/python/model_builder_helper.so: undefined symbol: _PyThreadState_UncheckedGet
================================================================================
INFO: Found 1 test target...
Target //ortools/linear_solver/python:model_builder_helper_test up-to-date:
  bazel-bin/ortools/linear_solver/python/model_builder_helper_test
INFO: Elapsed time: 1.491s, Critical Path: 1.14s
INFO: 2 processes: 7 action cache hit, 2 processwrapper-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//ortools/linear_solver/python:model_builder_helper_test                 FAILED in 1.0s
  /root/.cache/bazel/_bazel_root/238276933ebafbe5412dd515892860d4/execroot/_main/bazel-out/k8-fastbuild/testlogs/ortools/linear_solver/python/model_builder_helper_test/test.log

side note: inside the docker, forcing python 3.12, this is working:

$ bazel test --config=ci --@rules_python//python/config_settings:python_version=3.12 //ortools/linear_solver/python:model_builder_helper_test
...
//ortools/linear_solver/python:model_builder_helper_test                 PASSED in 2.6s

So it seems the toolchain 3.13 is not working as expected somehow

@Mizux
Copy link
Collaborator Author

Mizux commented Oct 10, 2025

same issue locally on my gLinux

> git log -1            
commit 6f160b1e62d9c0f99afac0f5453526e50e5c34b6 (HEAD -> mizux/dev, origin/mizux/dev)
> python3 -VV
Python 3.13.6 (main, Aug  7 2025, 10:53:54) [GCC 14.2.0]
> bazel test --config=ci //ortools/linear_solver/python:model_builder_helper_test
...
FAIL: //ortools/linear_solver/python:model_builder_helper_test (Exit 1) (see ~/.../execroot/_main/bazel-out/k8-fastbuild/testlogs/ortools/linear_solver/python/model_builder_helper_test/test.log)
INFO: From Testing //ortools/linear_solver/python:model_builder_helper_test:
==================== Test output for //ortools/linear_solver/python:model_builder_helper_test:
Traceback (most recent call last):
  File "~/.../sandbox/linux-sandbox/1633/execroot/_main/bazel-out/k8-fastbuild/bin/ortools/linear_solver/python/model_builder_helper_test.runfiles/_main/ortools/linear_solver/python/model_builder_helper_test.py", line 24, in <module>
    from ortools.linear_solver.python import model_builder_helper
ImportError: ~/.../sandbox/linux-sandbox/1633/execroot/_main/bazel-out/k8-fastbuild/bin/ortools/linear_solver/python/model_builder_helper_test.runfiles/_main/ortools/linear_solver/python/model_builder_helper.so: undefined symbol: _PyThreadState_UncheckedGet
================================================================================

@Mizux Mizux force-pushed the mizux/dev branch 2 times, most recently from c79a6db to 93afbbe Compare October 15, 2025 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build: Bazel Bazel based build issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant