Skip to content

CI: Prerelease, mypy, and freethreaded jobs failing due to Pythran error: KeyError: 'sep' #23958

@nickodell

Description

@nickodell

Describe your issue.

The error KeyError: 'sep' can be seen in the prerelease, mypy, and freethreaded jobs.

Newest successful job I can find: https://github.com/scipy/scipy/actions/runs/19202532934/job/54892728452#step:9:313

Oldest failing job I can find: https://github.com/scipy/scipy/actions/runs/19208289070/job/54906718527#step:9:347

Differences and similarities between jobs

Both jobs use the following pip packages.

Successfully installed beniget-0.4.2.post1 click-8.2.1 cython-3.2.0 gast-0.6.0 importlib_metadata-8.7.0 meson-1.9.1 meson-python-0.18.0 ninja-1.13.0 numpy-2.3.4 packaging-25.0 ply-3.11 pybind11-3.0.1 pyproject-metadata-0.9.1 pythran-0.18.0 setuptools-80.9.0 spin-0.15 zipp-3.23.0
Successfully installed certifi-2025.10.5 charset_normalizer-3.4.4 contourpy-1.3.3 coverage-7.11.2 cycler-0.12.1 execnet-2.1.1 fonttools-4.60.1 gmpy2-2.3.0a1 hypothesis-6.147.0 idna-3.11 iniconfig-2.3.0 kiwisolver-1.4.10rc0 matplotlib-3.10.7 mpmath-1.4.0b2 pillow-12.0.0 platformdirs-4.5.0 pluggy-1.6.0 pooch-1.8.2 pygments-2.19.2 pyparsing-3.3.0a1 pytest-9.0.0 pytest-cov-7.0.0 pytest-xdist-3.8.0 python-dateutil-2.9.0.post0 requests-2.32.5 six-1.17.0 sortedcontainers-2.4.0 threadpoolctl-3.6.0 urllib3-2.5.0
Successfully installed scipy-openblas32-0.3.29.265.1
Successfully installed numpy-2.4.0.dev0

Though note that NumPy is installed from a nightly wheel - I am not sure it would show differences. Edit: this is why.

As far as I can tell, the two runs use the same apt packages and runner image as well.

Finding jobs

I have been using the following shell script to search for runs that have the error, or for runs that don't have the error but did compile the relevant file.

Usage is ./logdl.sh scipy/scipy <run id>

#!/usr/bin/env bash
set -euo pipefail

REPO_NAME=${1?Missing repo name argument} # example: vitejs/vite
RUN_ID=${2?Missing run ID argument}

ZIPFILE=$(mktemp)
TMPDIR=$(mktemp -d)

Color_Off='\033[0m'
BBlack='\033[1;30m'
On_Cyan='\033[46m'

function downloadLogs() {
  echo "downloading logs for run $RUN_ID ..."
  if ! gh api /repos/$REPO_NAME/actions/runs/$RUN_ID/logs > $ZIPFILE; then
    saw_failure=0
    meaningful_test=0
    echo "$RUN_ID $saw_failure $meaningful_test" | tee -a pr_parse.log
    exit 0
  fi
  unzip -q -d $TMPDIR $ZIPFILE
  rm -f $ZIPFILE
}

function dumpLogs() {
  find $TMPDIR -type f -maxdepth 1 -print0 |
    while IFS= read -r -d $'\0' file; do
      echo
      basefile=$(basename "$file")
      echo -e "${BBlack}${On_Cyan} $basefile ${Color_Off}"
      echo

      cat "$file"
    done
}

downloadLogs
echo "Downloaded to $TMPDIR"
set +e
(cd $TMPDIR; grep -C 5 "spec.kwonlydefaults" *Prerelease\ deps*.txt)
grep_kw_errorcode=$?
(cd $TMPDIR; grep -C 5 "Generating 'scipy/linalg/_linalg_pythran" *Prerelease\ deps*.txt)
grep_gen_errorcode=$?
set -e

if [ "$grep_kw_errorcode" -eq 0 ]; then
     saw_failure=1
     meaningful_test=1
fi
if [ "$grep_kw_errorcode" -eq 1 ]; then
     saw_failure=0
     # Did we actually reach the point where we could have seen a failure?
     if [ "$grep_gen_errorcode" -eq 0 ]; then
         meaningful_test=1
     else
         meaningful_test=0
     fi
fi
if [ "$grep_kw_errorcode" -eq 2 ]; then
     saw_failure=0
     meaningful_test=0
fi
echo "$RUN_ID $saw_failure $meaningful_test" | tee -a pr_parse.log

Reproducing Code Example

I seem to be able to reproduce this by installing NumPy nightly or a build from main. Numpy 2.3.4 does not exhibit the problem.

pip install --pre --upgrade --timeout=60 -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
# or
pip install git+https://github.com/numpy/numpy.git

Other dependency versions:

array_api_strict==2.4.1
asv==0.6.5
asv_runner==0.2.1
attrs==25.4.0
beniget==0.4.2.post1
build==1.3.0
certifi==2025.10.5
charset-normalizer==3.4.4
click==8.2.1
coverage==7.11.0
Cython==3.1.6
cython-lint==0.18.1
distlib==0.4.0
execnet==2.1.1
filelock==3.20.0
gast==0.6.0
hypothesis==6.143.1
idna==3.11
importlib_metadata==8.7.0
iniconfig==2.3.0
json5==0.12.1
meson==1.9.1
meson-python==0.18.0
mpmath==1.3.0
mypy==1.10.0
mypy_extensions==1.1.0
ninja==1.13.0
numpy==2.3.4
packaging==25.0
platformdirs==4.5.0
pluggy==1.6.0
ply==3.11
pooch==1.8.2
pybind11==3.0.1
pycodestyle==2.14.0
Pygments==2.19.2
Pympler==1.1
pyproject-metadata==0.9.1
pyproject_hooks==1.2.0
pytest==8.4.2
pytest-cov==7.0.0
pytest-run-parallel==0.7.1
pytest-timeout==2.4.0
pytest-xdist==3.8.0
pythran==0.18.0
PyYAML==6.0.3
requests==2.32.5
ruff==0.14.3
scipy-openblas32==0.3.30.0.6
setuptools==80.9.0
sortedcontainers==2.4.0
spin==0.15
tabulate==0.9.0
threadpoolctl==3.6.0
tokenize_rt==6.2.0
types-psutil==7.0.0.20251001
typing_extensions==4.15.0
urllib3==2.5.0
virtualenv==20.35.4
zipp==3.23.0

Error message

FAILED: [code=1] scipy/linalg/_linalg_pythran.cpython-313-x86_64-linux-gnu.so.p/_linalg_pythran.cpp 
/opt/hostedtoolcache/Python/3.13.9/x64/bin/pythran -E ../scipy/linalg/_linalg_pythran.py -o scipy/linalg/_linalg_pythran.cpython-313-x86_64-linux-gnu.so.p/_linalg_pythran.cpp
WARNING: Overriding pythran description with argspec information for: numpy.arange
WARNING: Overriding pythran description with argspec information for: numpy.array
WARNING: Overriding pythran description with argspec information for: numpy.concatenate
WARNING: Overriding pythran description with argspec information for: numpy.empty
WARNING: Overriding pythran description with argspec information for: numpy.empty_like
WARNING: Overriding pythran description with argspec information for: numpy.fromiter
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.9/x64/bin/pythran", line 7, in <module>
    sys.exit(run())
             ~~~^^
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/run.py", line 190, in run
    pythran.compile_pythranfile(args.input_file,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/__init__.py", line 127, in __getattr__
    import pythran.toolchain
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/toolchain.py", line 6, in <module>
    from pythran.backend import Cxx, Python
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/backend.py", line 7, in <module>
    from pythran.analyses import LocalNodeDeclarations, GlobalDeclarations, Scope
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/analyses/__init__.py", line 12, in <module>
    from .aliases import Aliases, StrictAliases, InterproceduralAliases
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/analyses/aliases.py", line 6, in <module>
    from pythran.tables import functions, methods, MODULES
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/tables.py", line 4676, in <module>
    save_arguments((), MODULES)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/tables.py", line 4611, in save_arguments
    save_arguments(module_name + (elem,), signature)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.9/x64/lib/python3.13/site-packages/pythran/tables.py", line 4644, in save_arguments
    defaults += [spec.kwonlydefaults[kw] for kw in spec.kwonlyargs]
                 ~~~~~~~~~~~~~~~~~~~^^^^
KeyError: 'sep'

SciPy/NumPy/Python version and system information

1.17.0.dev0+git20251106.48dba5f 2.3.4 sys.version_info(major=3, minor=14, micro=0, releaselevel='final', serial=0)
Build Dependencies:
  blas:
    detection method: pkgconfig
    found: true
    has ilp64: false
    include directory: /home/nodell/scipy-ft/venv/lib/python3.14t/site-packages/scipy_openblas32/include
    lib directory: /home/nodell/scipy-ft/venv/lib/python3.14t/site-packages/scipy_openblas32/lib
    name: scipy-openblas
    openblas configuration: OpenBLAS 0.3.30 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64
    pc file directory: /home/nodell/scipy-ft
    version: 0.3.30
  lapack:
    detection method: pkgconfig
    found: true
    has ilp64: false
    include directory: /home/nodell/scipy-ft/venv/lib/python3.14t/site-packages/scipy_openblas32/include
    lib directory: /home/nodell/scipy-ft/venv/lib/python3.14t/site-packages/scipy_openblas32/lib
    name: scipy-openblas
    openblas configuration: OpenBLAS 0.3.30 DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=64
    pc file directory: /home/nodell/scipy-ft
    version: 0.3.30
  pybind11:
    detection method: config-tool
    include directory: unknown
    name: pybind11
    version: 3.0.1
Compilers:
  c:
    commands: cc
    linker: ld.bfd
    name: gcc
    version: 14.2.1
  c++:
    commands: c++
    linker: ld.bfd
    name: gcc
    version: 14.2.1
  cython:
    commands: cython
    linker: cython
    name: cython
    version: 3.1.6
  fortran:
    commands: gfortran
    linker: ld.bfd
    name: gcc
    version: 14.2.1
  pythran:
    include directory: ../venv/lib/python3.14t/site-packages/pythran
    version: 0.18.0
Machine Information:
  build:
    cpu: x86_64
    endian: little
    family: x86_64
    system: linux
  cross-compiled: false
  host:
    cpu: x86_64
    endian: little
    family: x86_64
    system: linux
Python Information:
  path: /home/nodell/scipy-ft/venv/bin/python
  version: '3.14'

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIItems related to the CI tools such as CircleCI, GitHub Actions or AzurePythranItems related to internal Pythran code baseupstream bugItems related to bugs in upstream projects

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions