#5415·or-tools

RoutingModel.AddSameActivityGroup unusable from Python — TypeError: argument 2 of type 'absl::Span< int const >'

Author: PedroOliveira117Created Sep 23, 2026Updated Sep 30, 2026
LabelsBugFeature RequestLang: PythonSolver: Routing & CP Solver

Version: 9.15.6755 Language: Python

Routing Solver (ortools.constraint_solver.pywrapcp.RoutingModel) Linux (aarch64), Docker/linuxkit, kernel 6.12.76, glibc 2.41. Python 3.13.15.

Steps to reproduce the behavior:

  1. Install ortools==9.15.6755 via pip
  2. Build a minimal RoutingModel:
python
from ortools.constraint_solver import pywrapcp

manager = pywrapcp.RoutingIndexManager(5, 1, 0)
routing = pywrapcp.RoutingModel(manager)
routing.AddSameActivityGroup([1, 2, 3])
  1. See error

What did you expect to see AddSameActivityGroup([1, 2, 3]) to succeed, per the documented signature (AddSameActivityGroup(self, nodes)) at https://or-tools.github.io/docs/python/classortools_1_1constraint__solver_1_1pywrapcp_1_1RoutingModel.html

What did you see instead? TypeError: in method 'RoutingModel_AddSameActivityGroup', argument 2 of type 'absl::Span< int const >'

Traced to the compiled _pywrapcp extension, not the Python wrapper. Source of the wrapper itself:

python
  def AddSameActivityGroup(self, nodes):
      return _pywrapcp.RoutingModel_AddSameActivityGroup(self, nodes)

Tried 6 different Python representations for nodes, all fail identically: list, tuple, array.array('i', ...), numpy.array(dtype=np.int64), numpy.array(dtype=np.int32), and a listwith explicit int(...) casts.