#867·pydub

Adapt `pydub` to Python 3.13 (audioop removed)

Author: netanelcyberCreated Oct 28, 2025Updated Sep 9, 2026

Description: Python 3.13 has removed the built-in audioop module, which pydub currently depends on in pydub/utils.py. As a result, import audioop fails on Python 3.13.

Proposed solution:

  • Wrap the import in a try-except block:
python
try:
    import audioop
except ImportError:
    import pyaudioop as audioop  # fallback for Python 3.13+
  • Add pyaudioop as an optional dependency in setup.py or pyproject.toml.
  • Optionally, include a clear error message if neither audioop nor pyaudioop is available.

Impact: This change ensures pydub remains compatible with Python 3.13 and higher, while maintaining backward compatibility with older Python versions.

Reference: