From 7eeeffe725e0cc564f0d60d906ca70bac3a522e7 Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Thu, 23 Jul 2026 19:52:13 +0000 Subject: [PATCH] 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 `setup.py bdist_wheel`. Wrap each source path in str() so the list contains plain strings. include_dirs are left as-is (distutils does not assert on them). --- 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 447dd5091d..45fa7428c1 100644 --- a/tools/setup_helpers/extension.py +++ b/tools/setup_helpers/extension.py @@ -106,8 +106,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, @@ -115,7 +115,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], @@ -127,7 +127,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,