From c242809bedd7b99988858405c7aae6e1f8bd1c53 Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Thu, 23 Jul 2026 19:41:52 +0000 Subject: [PATCH] [release/2.11] Pass extension sources as str, not pathlib.Path get_ext_modules() built the CppExtension/CUDAExtension `sources` lists from `_CSRC_DIR / "..."`, i.e. pathlib.Path objects. Newer setuptools/distutils enforces that `sources` is a list of str and now raises: AssertionError: 'sources' must be a list of strings which breaks the torchaudio wheel build (setup.py bdist_wheel) on release/2.11. Wrap each source path in str() so the list contains plain strings. include_dirs are left as-is (not asserted). --- tools/setup_helpers/extension.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/setup_helpers/extension.py b/tools/setup_helpers/extension.py index a8d0689cb5..50462ea1ff 100644 --- a/tools/setup_helpers/extension.py +++ b/tools/setup_helpers/extension.py @@ -117,8 +117,8 @@ def get_ext_modules(): extension( name="torchaudio.lib._torchaudio", sources=[ - _CSRC_DIR / "_torchaudio.cpp", - _CSRC_DIR / "utils.cpp", + str(_CSRC_DIR / "_torchaudio.cpp"), + str(_CSRC_DIR / "utils.cpp"), ], py_limited_api=True, extra_compile_args=extra_compile_args, @@ -126,7 +126,7 @@ def get_ext_modules(): ), extension( name="torchaudio.lib.libtorchaudio", - sources=[_CSRC_DIR / s for s in sources], + sources=[str(_CSRC_DIR / s) for s in sources], py_limited_api=True, extra_compile_args=extra_compile_args, include_dirs=[_CSRC_DIR.parent], @@ -138,7 +138,7 @@ def get_ext_modules(): extension( name="torchaudio.lib.torchaudio_prefixctc", sources=[ - _CSRC_DIR / "cuctc" / "src" / s + str(_CSRC_DIR / "cuctc" / "src" / s) for s in ["ctc_prefix_decoder.cpp", "ctc_prefix_decoder_kernel_v2.cu", "python_binding.cpp"] ], py_limited_api=True,